 <p><strong>Update:</strong></p> <ol> <li><p>GCC chokes on your function <code>stringlength</code>. Try this:</p> <pre><code>constexpr size_t stringlength(char const* str, size_t i=0) { return str ? (str[i] ? 1 + stringlength(str, i+1) : 0) : 0; } </code></pre></li> <li><p>To GCC 4.6.3 this seems dubious:</p> <pre><code>static constexpr int const* c = &amp;a[0]; static constexpr int const* d = &amp;b[0]; </code></pre> <p>Try this:</p> <pre><code>static constexpr int* c = &amp;a[0]; static constexpr int* d = &amp;b[0]; </code></pre></li> </ol> <p><strong>Old answer:</strong></p> <p>You code seems to be correct and with GCC 4.6.3 it also compiles.</p> <pre><code>int main() { const char* a = "hallo"; const char* b = "qallo"; std::cout &lt;&lt; is_equal(a,b,5) &lt;&lt; std::endl; constexpr const char* c = "hallo"; std::cout &lt;&lt; is_equal(a,c,5) &lt;&lt; std::endl; } </code></pre> <p>Be careful, that the strings you are giving to your functions are constants.</p> <p>See <a href="http://en.cppreference.com/w/cpp/language/constexpr" rel="nofollow">here</a> what is allowed with <code>constexpr</code>.</p>