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++/80639] New: ICE on valid C++11 code: in cxx_eval_outermost_constant_expr, at cp/constexpr.c:4642


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

            Bug ID: 80639
           Summary: ICE on valid C++11 code: in
                    cxx_eval_outermost_constant_expr, at
                    cp/constexpr.c:4642
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

It seems to be a recent regression. 


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170505 (experimental) [trunk revision 247627] (GCC)
$
$ g++-6.2 -c small.cpp
$
$ g++-trunk -c small.cpp
small.cpp: In instantiation of ‘constexpr void (A<B>::* const A<B>::h)()<0>’:
small.cpp:19:3:   required from ‘static void B::K<<anonymous> >::n() [with int
<anonymous> = 0]’
small.cpp:7:24:   required from here
small.cpp:13:41: internal compiler error: in cxx_eval_outermost_constant_expr,
at cp/constexpr.c:4642
   template < int u > static constexpr T h = &B::m < u >;
                                         ^
0x8e50dd cxx_eval_outermost_constant_expr
        ../../gcc-source-trunk/gcc/cp/constexpr.c:4641
0x74e6dc store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc-source-trunk/gcc/cp/typeck2.c:827
0x6a27a2 check_initializer
        ../../gcc-source-trunk/gcc/cp/decl.c:6363
0x6cf7dd cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/decl.c:7035
0x6f456a instantiate_decl(tree_node*, bool, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:22697
0x787af7 maybe_instantiate_decl
        ../../gcc-source-trunk/gcc/cp/decl2.c:5012
0x789539 mark_used(tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/decl2.c:5108
0x733853 lookup_and_finish_template_variable(tree_node*, tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/pt.c:9090
0x702eb6 tsubst_qualified_id
        ../../gcc-source-trunk/gcc/cp/pt.c:14358
0x7045ee tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:16879
0x6f7b47 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:16467
0x6f8f3e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:15732
0x6f753b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:15718
0x6f8343 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:15944
0x6f57a4 instantiate_decl(tree_node*, bool, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:22898
0x7456d2 instantiate_pending_templates(int)
        ../../gcc-source-trunk/gcc/cp/pt.c:23019
0x78b0f1 c_parse_final_cleanups()
        ../../gcc-source-trunk/gcc/cp/decl2.c:4526
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$


----------------------------------------------------------


template < typename > struct A;

struct B
{ 
  template < int > void m ();
  template < int > struct K { static void n (); };
  void p () { K < 0 >::n (); }
};

template <> struct A < B >
{ 
  using T = void (A::*)();
  template < int u > static constexpr T h = &B::m < u >;
};

template < int v > void B::K < v >::n ()
{ 
  using S = A < B >;
  S::h < 0 >;
}

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