Bug 60199 - 'error: field initializer is not constant' when initializing static member function pointer to a function
Summary: 'error: field initializer is not constant' when initializing static member fu...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.2
: P3 minor
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: constexpr
  Show dependency treegraph
 
Reported: 2014-02-14 15:48 UTC by AbigailBuccaneer
Modified: 2014-06-06 09:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.10.0, 4.9.0
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description AbigailBuccaneer 2014-02-14 15:48:56 UTC
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
};

//---------------------------------------
Comment 1 Daniel Krügler 2014-02-16 17:25:49 UTC
Seems to be fixed in 4.9 trunk
Comment 2 Paolo Carlini 2014-06-06 09:48:57 UTC
Yes, this is fixed, I'm adding the testcase and closing the bug.
Comment 3 paolo@gcc.gnu.org 2014-06-06 09:53:05 UTC
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
Comment 4 Paolo Carlini 2014-06-06 09:54:00 UTC
Done.