https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84002
Sunil Pandey <skpgkp1 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hjl.tools at gmail dot com --- Comment #1 from Sunil Pandey <skpgkp1 at gmail dot com> --- I also hit same issue while compiling opencv with gcc 8. $ cat test_mat.cpp.i namespace { template <typename> class g { public: typedef double d; }; template <typename, int, int> class e {}; typedef e<double, 2, 2> f; class h { public: template <typename i, int j, int k> operator e<i, j, k>() const; }; template <typename i> class c : h { public: c(int, int); template <int j, int k> operator e<typename g<i>::d, j, k>() const; }; template <typename i> template <int j, int k> c<i>::operator e<typename g<i>::d, j, k>() const { e<typename g<i>::d, j, k> l = h::operator e<typename g<i>::d, j, k>(); } c<double> a(c<double>(2, 2)); f b(a); } $ g++ --version g++ (GCC) 8.0.1 20180123 (experimental) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++ -msse -msse2 -msse3 -O2 -o test_mat.cpp.i.o -c test_mat.cpp.i -w test_mat.cpp.i: In instantiation of ‘{anonymous}::c<i>::operator {anonymous}::e<typename {anonymous}::g< <template-parameter-1-1> >::d, j, k>() const [with int j = 2; int k = 2; i = double; typename {anonymous}::g< <template-parameter-1-1> >::d = double]’: test_mat.cpp.i:23:6: required from here test_mat.cpp.i:20:33: internal compiler error: in tsubst_baselink, at cp/pt.c:14451 e<typename g<i>::d, j, k> l = h::operator e<typename g<i>::d, j, k>(); ^ 0x62aaa1 tsubst_baselink ../../gcc-main.3UZE/gcc/cp/pt.c:14451 0x936dfb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc-main.3UZE/gcc/cp/pt.c:17996 0x93583f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc-main.3UZE/gcc/cp/pt.c:17604 0x943269 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc-main.3UZE/gcc/cp/pt.c:17041 0x943269 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-main.3UZE/gcc/cp/pt.c:16779 0x945c82 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-main.3UZE/gcc/cp/pt.c:14645 0x945c82 tsubst_init ../../gcc-main.3UZE/gcc/cp/pt.c:14649 0x944b84 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-main.3UZE/gcc/cp/pt.c:16109 0x940461 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-main.3UZE/gcc/cp/pt.c:16263 0x93f6f8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc-main.3UZE/gcc/cp/pt.c:15971 0x93f6f8 instantiate_decl(tree_node*, bool, bool) ../../gcc-main.3UZE/gcc/cp/pt.c:23329 0x969ccb instantiate_pending_templates(int) ../../gcc-main.3UZE/gcc/cp/pt.c:23445 0x88c80b c_parse_final_cleanups() ../../gcc-main.3UZE/gcc/cp/decl2.c:4705 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. GCC 7 works fine. $ g++ --version g++ (GCC) 7.2.1 20180123 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++ -msse -msse2 -msse3 -O2 -o test_mat.cpp.i.o -c test_mat.cpp.i -w $ echo $? 0