http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54086
Bug #: 54086 Summary: GCC should allow constexpr and const together Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: steve...@gmail.com GCC and Clang differ in how they handle this code. Clang compiles it, but GCC does not: #include <iostream> static constexpr const char Data[] = { 'D', 'A', 'T', 'A', }; static constexpr const char *data_func() { return Data; } int main(int argc, char **argv) { char c = 'T'; switch(c) { case *data_func(): std::cout << "GOT A D" << std::endl; break; case *(data_func() + 2): std::cout << "GOT A T" << std::endl; } } $ clang++ --version clang version 3.2 Target: x86_64-unknown-linux-gnu Thread model: posix $ g++ -dumpversion 4.6.1 $ g++ main.cpp -std=c++0x main.cpp:163:48: error: both ‘const’ and ‘constexpr’ cannot be used here http://thread.gmane.org/gmane.comp.compilers.clang.devel/22984 Thanks,