User account creation filtered due to spam.

Bug 71543 - [concepts] ICE on ill-formed declaration of a parameter with a constrained-type-specifier in a requires expression
Summary: [concepts] ICE on ill-formed declaration of a parameter with a constrained-ty...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks: concepts
  Show dependency treegraph
 
Reported: 2016-06-15 14:55 UTC by Tom Honermann
Modified: 2017-05-15 04:31 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 7.0
Last reconfirmed: 2017-03-07 00:00:00


Attachments
repo test case for confirming bug (383 bytes, text/x-csrc)
2017-03-07 00:54 UTC, Jeff Trull
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Honermann 2016-06-15 14:55:12 UTC
The following ill-formed code triggers an ICE in gcc trunk r236947.  The code is ill-formed because constrained-type-specifiers are not permitted to declare parameters in requires expressions.

$ cat t.cpp
template<typename T>
concept bool C1 = true;
template<typename T>
concept bool C2 = requires(C1 c1) {};

$ svn info
Path: .
Working Copy Root Path: /home/tom/src/gcc-trunk
URL: svn://gcc.gnu.org/svn/gcc/trunk
Relative URL: ^/trunk
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 236947
Node Kind: directory
Schedule: normal
Last Changed Author: jason
Last Changed Rev: 236947
Last Changed Date: 2016-05-31 15:49:22 -0400 (Tue, 31 May 2016)

$ gcc --version
gcc (GCC) 7.0.0 20160531 (experimental)
...

$ g++ -c -std=c++1z -fconcepts t.cpp 
t.cpp:4:28: internal compiler error: in synthesize_implicit_template_parm, at cp/parser.c:37843
 concept bool C2 = requires(C1 c1) {};
                            ^~
0x753793 synthesize_implicit_template_parm
        ../../gcc-trunk/gcc/cp/parser.c:37843
0x7539cc cp_parser_maybe_constrained_type_specifier
        ../../gcc-trunk/gcc/cp/parser.c:16463
0x753af8 cp_parser_nonclass_name
        ../../gcc-trunk/gcc/cp/parser.c:16541
0x761d41 cp_parser_type_name
        ../../gcc-trunk/gcc/cp/parser.c:16347
0x761d41 cp_parser_simple_type_specifier
        ../../gcc-trunk/gcc/cp/parser.c:16261
0x75dbdd cp_parser_type_specifier
        ../../gcc-trunk/gcc/cp/parser.c:15914
0x773494 cp_parser_decl_specifier_seq
        ../../gcc-trunk/gcc/cp/parser.c:12758
0x775159 cp_parser_parameter_declaration
        ../../gcc-trunk/gcc/cp/parser.c:20448
0x7759a4 cp_parser_parameter_declaration_list
        ../../gcc-trunk/gcc/cp/parser.c:20263
0x775e44 cp_parser_parameter_declaration_clause
        ../../gcc-trunk/gcc/cp/parser.c:20184
0x7592db cp_parser_requirement_parameter_list
        ../../gcc-trunk/gcc/cp/parser.c:24391
0x7592db cp_parser_requires_expression
        ../../gcc-trunk/gcc/cp/parser.c:24362
0x7592db cp_parser_primary_expression
        ../../gcc-trunk/gcc/cp/parser.c:5098
0x762775 cp_parser_postfix_expression
        ../../gcc-trunk/gcc/cp/parser.c:6688
0x760b5c cp_parser_unary_expression
        ../../gcc-trunk/gcc/cp/parser.c:7986
0x76ad47 cp_parser_cast_expression
        ../../gcc-trunk/gcc/cp/parser.c:8663
0x76b333 cp_parser_binary_expression
        ../../gcc-trunk/gcc/cp/parser.c:8764
0x76bc24 cp_parser_assignment_expression
        ../../gcc-trunk/gcc/cp/parser.c:9051
0x76c06a cp_parser_constant_expression
        ../../gcc-trunk/gcc/cp/parser.c:9321
0x76c8c4 cp_parser_initializer_clause
        ../../gcc-trunk/gcc/cp/parser.c:20837
...
Comment 1 Jeff Trull 2017-03-07 00:54:42 UTC
Created attachment 40899 [details]
repo test case for confirming bug

I observe the (seemingly) same ICE with 7.0.1 on Compiler Explorer (https://godbolt.org/) today with the attached code.
Comment 2 Martin Sebor 2017-03-07 23:56:15 UTC
Confirmed.  The ICE seems to have been there since the introduction of -fconcepts.