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

            Bug ID: 88184
           Summary: ICE on (invalid) C++ code when compiled with
                    -std=c++2a: unexpected expression ‘f<T>’ of kind
                    template_id_expr
           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 appears to be a recent regression. 

$ g++tk -v
Using built-in specs.
COLLECT_GCC=g++tk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 9.0.0 20181124 (experimental) [trunk revision 266426] (GCC) 
$ 
$ g++tk -std=c++17 -c tmp.cpp
tmp.cpp: In function ‘void g()’:
tmp.cpp:10:9: error: expected primary-expression before ‘>’ token
   10 |   f < T > ();
      |         ^
tmp.cpp:10:12: error: expected primary-expression before ‘)’ token
   10 |   f < T > ();
      |            ^
$ 
$ g++tk -std=c++2a -c tmp.cpp
tmp.cpp: In function ‘void g()’:
tmp.cpp:10:12: internal compiler error: unexpected expression ‘f<T>’ of kind
template_id_expr
   10 |   f < T > ();
      |            ^
0x7f1508 cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:4921
0x7f6c59 cxx_eval_outermost_constant_expr
        ../../gcc-source-trunk/gcc/cp/constexpr.c:5033
0x7faa27 fold_non_dependent_expr(tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/constexpr.c:5334
0x93473e build_non_dependent_expr(tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:26299
0x9b88ea finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc-source-trunk/gcc/cp/semantics.c:2434
0x90d2f3 cp_parser_postfix_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:7303
0x8f3e8f cp_parser_unary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8382
0x8ed1bf cp_parser_cast_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9265
0x8ed84e cp_parser_binary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9367
0x8ee133 cp_parser_assignment_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9663
0x8ee3d4 cp_parser_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9830
0x8f2ea4 cp_parser_expression_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11365
0x900ea9 cp_parser_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11161
0x90208f cp_parser_statement_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:11508
0x90217f cp_parser_compound_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11462
0x90239b cp_parser_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:22266
0x90239b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:22301
0x902c42 cp_parser_function_definition_after_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:27333
0x91a53a cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:27250
0x91a53a cp_parser_init_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:19995
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.
$ 


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


namespace A
{
  void f ();
}

using A::f;

template < typename T > void g ()
{
  f < T > ();
}

Reply via email to