public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60199] New: 'error: field initializer is not constant' error when initializing static member function pointer to a function
@ 2014-02-14 15:49 abigail.buccaneer at gmail dot com
  2014-02-16 17:25 ` [Bug c++/60199] 'error: field initializer is not constant' " daniel.kruegler at googlemail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: abigail.buccaneer at gmail dot com @ 2014-02-14 15:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60199

            Bug ID: 60199
           Summary: 'error: field initializer is not constant' error when
                    initializing static member function pointer to a
                    function
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abigail.buccaneer at gmail dot com

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
};

//---------------------------------------


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/60199] 'error: field initializer is not constant' when initializing static member function pointer to a function
  2014-02-14 15:49 [Bug c++/60199] New: 'error: field initializer is not constant' error when initializing static member function pointer to a function abigail.buccaneer at gmail dot com
@ 2014-02-16 17:25 ` daniel.kruegler at googlemail dot com
  2014-06-06  9:49 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-02-16 17:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60199

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
Seems to be fixed in 4.9 trunk
>From gcc-bugs-return-443837-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Feb 16 17:26:35 2014
Return-Path: <gcc-bugs-return-443837-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 591 invoked by alias); 16 Feb 2014 17:26:34 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 567 invoked by uid 48); 16 Feb 2014 17:26:30 -0000
From: "reichelt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60225] New: [4.9 Regression] [c++11] ICE initializing constexpr array
Date: Sun, 16 Feb 2014 17:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: ice-on-invalid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: reichelt at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter
Message-ID: <bug-60225-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-02/txt/msg01594.txt.bz2
Content-length: 2319

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`225

            Bug ID: 60225
           Summary: [4.9 Regression] [c++11] ICE initializing constexpr
                    array
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet (compiled with "-std=c++11") triggers
an ICE on trunk:

=========================================struct A
{
  constexpr A() {}
  static constexpr A a[2] = {};
};
=========================================
bug.cc:4:30: internal compiler error: in literal_type_p, at cp/semantics.c:7365
   static constexpr A a[2] = {};
                              ^
0x737157 literal_type_p(tree_node*)
        ../../gcc/gcc/cp/semantics.c:7365
0x7388bd ensure_literal_type_for_constexpr_object(tree_node*)
        ../../gcc/gcc/cp/semantics.c:7386
0x5d8ebf cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6206
0x6865e6 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ../../gcc/gcc/cp/decl2.c:985
0x6a611f cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:20429
0x6a9724 cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:19976
0x6a9724 cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:19210
0x6a9724 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19437
0x6a9724 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14302
0x6c2ba0 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11547
0x6c9799 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11137
0x6acc63 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:11086
0x6d3f12 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10983
0x6d2c08 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10869
0x6d44aa cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6d44aa c_parse_file()
        ../../gcc/gcc/cp/parser.c:31536
0x7f3813 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
Please submit a full bug report, [etc.]


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/60199] 'error: field initializer is not constant' when initializing static member function pointer to a function
  2014-02-14 15:49 [Bug c++/60199] New: 'error: field initializer is not constant' error when initializing static member function pointer to a function abigail.buccaneer at gmail dot com
  2014-02-16 17:25 ` [Bug c++/60199] 'error: field initializer is not constant' " daniel.kruegler at googlemail dot com
@ 2014-06-06  9:49 ` paolo.carlini at oracle dot com
  2014-06-06  9:53 ` paolo at gcc dot gnu.org
  2014-06-06  9:54 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-06  9:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60199

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Yes, this is fixed, I'm adding the testcase and closing the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/60199] 'error: field initializer is not constant' when initializing static member function pointer to a function
  2014-02-14 15:49 [Bug c++/60199] New: 'error: field initializer is not constant' error when initializing static member function pointer to a function abigail.buccaneer at gmail dot com
  2014-02-16 17:25 ` [Bug c++/60199] 'error: field initializer is not constant' " daniel.kruegler at googlemail dot com
  2014-06-06  9:49 ` paolo.carlini at oracle dot com
@ 2014-06-06  9:53 ` paolo at gcc dot gnu.org
  2014-06-06  9:54 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-06-06  9:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60199

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/60199] 'error: field initializer is not constant' when initializing static member function pointer to a function
  2014-02-14 15:49 [Bug c++/60199] New: 'error: field initializer is not constant' error when initializing static member function pointer to a function abigail.buccaneer at gmail dot com
                   ` (2 preceding siblings ...)
  2014-06-06  9:53 ` paolo at gcc dot gnu.org
@ 2014-06-06  9:54 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-06  9:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60199

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.10.0, 4.9.0
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-06  9:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14 15:49 [Bug c++/60199] New: 'error: field initializer is not constant' error when initializing static member function pointer to a function abigail.buccaneer at gmail dot com
2014-02-16 17:25 ` [Bug c++/60199] 'error: field initializer is not constant' " daniel.kruegler at googlemail dot com
2014-06-06  9:49 ` paolo.carlini at oracle dot com
2014-06-06  9:53 ` paolo at gcc dot gnu.org
2014-06-06  9:54 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).