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++/59268] New: [4.7/4.8/4.9 Regression] [c++11] ICE with constexpr in a virtual function


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

            Bug ID: 59268
           Summary: [4.7/4.8/4.9 Regression] [c++11] ICE with constexpr in
                    a virtual function
           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 valid code snippet (compiled with "-std=c++11" or "-std=c++0x"
for older compilers) triggers an ICE since GCC 4.6.1:

===================================
template<typename> struct A
{
  constexpr A(int) {}

  virtual void foo()
  {
    constexpr A<void> a(0);
  }
};
===================================

bug.cc: In instantiation of 'void A< <template-parameter-1-1> >::foo() [with
<template-parameter-1-1> = void]':
bug.cc:14:2:   required from here
bug.cc:12:26: internal compiler error: in tsubst_copy, at cp/pt.c:12862
     constexpr A<void> a(0);
                          ^
0x5de3f3 tsubst_copy
        ../../gcc/gcc/cp/pt.c:12862
0x5bba96 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:15071
0x5bcde6 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:14873
0x5c5ab7 tsubst_expr
        ../../gcc/gcc/cp/pt.c:13776
0x5c6d7b tsubst_expr
        ../../gcc/gcc/cp/pt.c:13298
0x5c571e tsubst_expr
        ../../gcc/gcc/cp/pt.c:13395
0x5c271c instantiate_decl(tree_node*, int, bool)
        ../../gcc/gcc/cp/pt.c:19641
0x601167 instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:19753
0x63c933 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4131
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]