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++/66564] ICE on explicit instantiation of nested template class


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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trippels at gcc dot gnu.org

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Confirmed. All version are affected:

markus@x4 tmp % clang++ -std=c++14 -c foo2.ii
foo2.ii:2:1: error: too few template parameters in template redeclaration
template <> template <typename _T_> class Outer<_T_>::Inner<_T_> {};
^~~~~~~~~~~
foo2.ii:1:1: note: previous template declaration is here
template <typename> struct Outer { template <typename> struct Inner; };
^~~~~~~~~~~~~~~~~~~
foo2.ii:3:29: error: explicit instantiation of undefined template
'Outer<int>::Inner<int>'
template struct Outer<int>::Inner<int>;
                            ^
foo2.ii:1:63: note: template is declared here
template <typename> struct Outer { template <typename> struct Inner; };
                                                              ^
2 errors generated.
markus@x4 tmp % icpc -std=c++14 -c foo2.ii
foo2.ii(2): error: nontype "Outer<<unnamed>>::Inner [with <unnamed>=_T_]" is
not a template
  template <> template <typename _T_> class Outer<_T_>::Inner<_T_> {};
                                                        ^

foo2.ii(2): error: this declaration cannot have multiple "template <...>"
clauses
  template <> template <typename _T_> class Outer<_T_>::Inner<_T_> {};
                                            ^

foo2.ii(3): error: incomplete type is not allowed
  template struct Outer<int>::Inner<int>;
           ^

compilation aborted for foo2.ii (code 2)

markus@x4 tmp % g++ -std=c++14 -c foo2.ii
foo2.ii:2:55: internal compiler error: in retrieve_specialization, at
cp/pt.c:1183
 template <> template <typename _T_> class Outer<_T_>::Inner<_T_> {};
                                                       ^~~~~~~~~~
0x6a2e8f retrieve_specialization
        ../../gcc/gcc/cp/pt.c:1180
0x6c12d4 tsubst_decl
        ../../gcc/gcc/cp/pt.c:11689
0x6b8f07 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:12897
0x6d0fdc most_specialized_partial_spec
        ../../gcc/gcc/cp/pt.c:21075
0x6e94e0 instantiate_class_template_1
        ../../gcc/gcc/cp/pt.c:9847
0x6e94e0 instantiate_class_template(tree_node*)
        ../../gcc/gcc/cp/pt.c:10412
0x78c33b complete_type(tree_node*)
        ../../gcc/gcc/cp/typeck.c:133
0x6edeae do_type_instantiation(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/pt.c:21352
0x772329 cp_parser_explicit_instantiation
        ../../gcc/gcc/cp/parser.c:15662
0x782d11 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12132
0x7815a6 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12059
0x7818c8 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4350
0x7818c8 c_parse_file()
        ../../gcc/gcc/cp/parser.c:37581
0x8e4772 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1070

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