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++/60389] New: [4.8/4,9 Regression] ICE with inheriting constructors and wrong usage of constexpr


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

            Bug ID: 60389
           Summary: [4.8/4,9 Regression] ICE with inheriting constructors
                    and wrong usage of constexpr
           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 since GCC 4.8.0:

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

struct B : A
{
  using A::A;
};

constexpr B b;
===========================================

bug.cc:11:13: error: the type 'const B' of constexpr variable 'b' is not
literal
 constexpr B b;
             ^
bug.cc:6:8: note: 'B' is not literal because:
 struct B : A
        ^
bug.cc:6:8: note:   'B' 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:8:12: note: 'template<class ... T> B::B(T ...)' is not usable as a
constexpr function because:
   using A::A;
            ^
bug.cc:8:12: internal compiler error: tree check: expected function_decl, have
template_decl in is_valid_constexpr_fn, at cp/semantics.c:7434
0xdc0f54 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9192
0x73e7f7 tree_check
        ../../gcc/gcc/tree.h:2709
0x73e7f7 is_valid_constexpr_fn
        ../../gcc/gcc/cp/semantics.c:7434
0x742fd0 explain_invalid_constexpr_fn(tree_node*)
        ../../gcc/gcc/cp/semantics.c:8019
0x73f4f2 ensure_literal_type_for_constexpr_object(tree_node*)
        ../../gcc/gcc/cp/semantics.c:7374
0x5dcddf cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6206
0x6ce58d cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16819
0x6cfd49 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11205
0x6b3003 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:11086
0x6da2d2 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10983
0x6d8fc8 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10869
0x6da87a cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6da87a c_parse_file()
        ../../gcc/gcc/cp/parser.c:31590
0x7fa103 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
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]