The following code compiles in Clang 3.3, but not GCC 4.8.2: //--------------------------------------- // g++ -std=c++11 -Wall -Wextra -pedantic void f() {} static constexpr void (*g1)() = &f; // ok static constexpr void (*g2)() = f; // ok struct S { static constexpr void (*g3)() = &f; // ok static constexpr void (*g4)() = f; // error: field initializer is not constant }; //---------------------------------------
Seems to be fixed in 4.9 trunk
Yes, this is fixed, I'm adding the testcase and closing the bug.
Author: paolo Date: Fri Jun 6 09:52:33 2014 New Revision: 211310 URL: http://gcc.gnu.org/viewcvs?rev=211310&root=gcc&view=rev Log: 2014-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60199 * g++.dg/cpp0x/constexpr-60199.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-60199.C Modified: trunk/gcc/testsuite/ChangeLog
Done.