This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/58610] New: [4.7/4.8/4.9 Regression] [c++11] ICE with constexpr of class with template constructor


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

            Bug ID: 58610
           Summary: [4.7/4.8/4.9 Regression] [c++11] ICE with constexpr of
                    class with template constructor
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          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
since GCC 4.7.0:

=============================
struct A
{
  template<typename> A();
};

constexpr A a;
=============================

bug.cc:6:13: error: the type 'const A' of constexpr variable 'a' is not literal
 constexpr A a;
             ^
bug.cc:1:8: note: 'A' is not literal because:
 struct A
        ^
bug.cc:1:8: note:   'A' is not an aggregate, does not have a trivial default
constructor, and has no constexpr constructor that is not a copy or move
constructor
bug.cc:6:13: internal compiler error: tree check: expected function_decl, have
template_decl in explain_non_literal_class, at cp/class.c:5327
 constexpr A a;
             ^
0xcd83ea tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9176
0x5f099c tree_check
        ../../gcc/gcc/tree.h:2609
0x5f099c explain_non_literal_class(tree_node*)
        ../../gcc/gcc/cp/class.c:5327
0x6bf46b ensure_literal_type_for_constexpr_object(tree_node*)
        ../../gcc/gcc/cp/semantics.c:5814
0x5696fb cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6157
0x65119f cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16568
0x6518bf cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10986
0x653740 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10867
0x65c76e cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65b4da cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65cda6 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65cda6 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28900
0x7707e3 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]