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

            Bug ID: 70266
           Summary: ICE on invalid code on x86_64-linux-gnu: unexpected
                    expression ‘foo’ of kind overload
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following causes an ICE when compiled with the current GCC trunk (with
-fgnu-tm) on x86_64-linux-gnu in both 32-bit and 64-bit modes. 


$ 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/6.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 6.0.0 20160317 (experimental) [trunk revision 234278] (GCC) 
$ 
$ g++-trunk -fgnu-tm -c small.cpp
small.cpp: In function ‘int foo(int, T)’:
small.cpp:5:48: internal compiler error: unexpected expression ‘foo’ of kind
overload
   return __transaction_atomic noexcept (foo) (1);
                                                ^
0x84f0df cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3881
0x853999 cxx_eval_outermost_constant_expr
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3939
0x78afeb build_must_not_throw_expr(tree_node*, tree_node*)
        ../../gcc-source-trunk/gcc/cp/except.c:380
0x7c215f build_transaction_expr(unsigned int, tree_node*, int, tree_node*)
        ../../gcc-source-trunk/gcc/cp/semantics.c:8622
0x73fc35 cp_parser_transaction_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:36902
0x73fc35 cp_parser_unary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:7781
0x740097 cp_parser_cast_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8665
0x740695 cp_parser_binary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8767
0x740f80 cp_parser_assignment_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9055
0x743859 cp_parser_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9222
0x732350 cp_parser_jump_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11802
0x732350 cp_parser_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10414
0x7329cc cp_parser_statement_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:10806
0x732abf cp_parser_compound_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10760
0x7512ff cp_parser_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:20653
0x7512ff cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:20689
0x751da1 cp_parser_function_definition_after_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:25351
0x752997 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:25263
0x752997 cp_parser_init_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:18429
0x753cd3 cp_parser_single_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:25811
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 


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


template < typename T > 
int foo (int x, T t)
{
  return __transaction_atomic noexcept (foo) (1);  // foo should be "t" 
}

Reply via email to