Created attachment 42793 [details] gzipped C++ source code The attached C++ source code, with recent gcc trunk, does this: In file included from array_real.cpp:28: array_tlp.hpp: In instantiation of ‘void ArrayOperatorF() [with K = double; KK = double]’: array_real.cpp:45:35: required from here array_tlp.hpp:1760:27: internal compiler error: in tsubst_copy, at cp/pt.c:14884 0x7e5bf2 tsubst_copy ../../trunk/gcc/cp/pt.c:14884 0x7cc740 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bo ol) ../../trunk/gcc/cp/pt.c:18294 0x7cf287 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bo ol) ../../trunk/gcc/cp/pt.c:17929 0x7cc588 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bo ol) ../../trunk/gcc/cp/pt.c:17438 0x7cd121 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bo ol) This bug seems to have been around since before revision 248835. Here is a reduced piece of code which seems to demonstrate the problem: void a(); namespace { void a(); } template <class, class> b() { a } void c { b<double, double>() }
Confirmed.
Started with r248250. Slightly cleaned up testcase: void foo (); namespace { void foo (); } template <class, class> void bar () { void *p = (void *) foo; } void baz () { bar<double, double> (); }
Author: nathan Date: Tue Dec 5 17:29:58 2017 New Revision: 255429 URL: https://gcc.gnu.org/viewcvs?rev=255429&root=gcc&view=rev Log: [PR C++/83287] Mark lookup for keeping https://gcc.gnu.org/ml/gcc-patches/2017-12/msg00242.html PR c++/83287 * tree.c (build_min): Check CAST_EXPR arg for OVERLOADs. * g++.dg/lookup/pr83287.C: New. Added: trunk/gcc/testsuite/g++.dg/lookup/pr83287.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/tree.c trunk/gcc/testsuite/ChangeLog
Fixed 255429.
I am still seeing the original unreduced code going wrong: In file included from array_real.cpp:28: array_tlp.hpp: In instantiation of ‘void ArrayOperatorF() [with K = double; KK = double]’: array_real.cpp:45:35: required from here array_tlp.hpp:1760:27: internal compiler error: in tsubst_copy, at cp/pt.c:14881 with revision 256722. The reduced code seems to work fine. Time for a deeper look ?
Reduced testcase that still ICEs, starting with the same revision: void foo (); namespace { void foo (); } template <class, class T> void bar () { new T (foo); } void baz () { bar <double, double> (); }
Author: nathan Date: Wed Jan 17 18:11:49 2018 New Revision: 256809 URL: https://gcc.gnu.org/viewcvs?rev=256809&root=gcc&view=rev Log: [C++/83287] Another overload lookup ice https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01580.html PR c++/83287 * init.c (build_raw_new_expr): Scan list for lookups to keep. PR c++/83287 * g++.dg/lookup/pr83287-2.C: New. Added: trunk/gcc/testsuite/g++.dg/lookup/pr83287-2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/init.c trunk/gcc/testsuite/ChangeLog
Resolved r256809. Manually tested original testcase this time too.