public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95931] New: ICE in dependent_type_p, at cp/pt.c:26326
@ 2020-06-27  4:22 haoxintu at gmail dot com
  2020-07-03  4:04 ` [Bug c++/95931] " haoxintu at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-27  4:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95931
           Summary: ICE in dependent_type_p, at cp/pt.c:26326
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

This code, bug.cc, reduced by C-Reduce, makes GCC-trunk ICE.

$cat bug.cc
void a { [] (auto, volatile b


$g++ bug.cc
bug.cc:1:6: error: variable or field ‘a’ declared void
    1 | void a { [] (auto, volatile b
      |      ^
bug.cc:1:29: error: ‘b’ does not name a type
    1 | void a { [] (auto, volatile b
      |                             ^
bug.cc:2: error: expected ‘,’ or ‘...’ at end of input
bug.cc:1:30: error: expected ‘)’ at end of input
    1 | void a { [] (auto, volatile b
      |             ~                ^
      |                              )
bug.cc:2: internal compiler error: in dependent_type_p, at cp/pt.c:26326
0x6551ca dependent_type_p(tree_node*)
        ../../gcc/cp/pt.c:26326
0x8fc1bb require_complete_types_for_parms
        ../../gcc/cp/decl.c:13832
0x8fc1bb check_function_type
        ../../gcc/cp/decl.c:16043
0x8fc1bb start_preparsed_function(tree_node*, tree_node*, int)
        ../../gcc/cp/decl.c:16257
0x956a15 start_lambda_function(tree_node*, tree_node*)
        ../../gcc/cp/lambda.c:1425
0x9a912b cp_parser_lambda_body
        ../../gcc/cp/parser.c:11264
0x9a912b cp_parser_lambda_expression
        ../../gcc/cp/parser.c:10640
0x9a912b cp_parser_primary_expression
        ../../gcc/cp/parser.c:5443
0x9b2960 cp_parser_postfix_expression
        ../../gcc/cp/parser.c:7296
0x99564a cp_parser_binary_expression
        ../../gcc/cp/parser.c:9609
0x9971ae cp_parser_assignment_expression
        ../../gcc/cp/parser.c:9914
0x995f6d cp_parser_constant_expression
        ../../gcc/cp/parser.c:10208
0x9966d1 cp_parser_initializer_clause
        ../../gcc/cp/parser.c:23272
0x99683a cp_parser_initializer_list
        ../../gcc/cp/parser.c:23550
0x99683a cp_parser_braced_list
        ../../gcc/cp/parser.c:23311
0x99aa3a cp_parser_initializer
        ../../gcc/cp/parser.c:23228
0x9c259b cp_parser_init_declarator
        ../../gcc/cp/parser.c:20903
0x9a36d2 cp_parser_simple_declaration
        ../../gcc/cp/parser.c:13785
0x9cc926 cp_parser_declaration
        ../../gcc/cp/parser.c:13484
0x9cd06a cp_parser_translation_unit
        ../../gcc/cp/parser.c:4761
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.


$g++ --version
g++ (GCC) 11.0.0 20200626 (experimental)
Copyright (C) 2020 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/95931] ICE in dependent_type_p, at cp/pt.c:26326
  2020-06-27  4:22 [Bug c++/95931] New: ICE in dependent_type_p, at cp/pt.c:26326 haoxintu at gmail dot com
@ 2020-07-03  4:04 ` haoxintu at gmail dot com
  2020-10-29 15:10 ` mpolacek at gcc dot gnu.org
  2021-08-12 15:05 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: haoxintu at gmail dot com @ 2020-07-03  4:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Haoxin Tu <haoxintu at gmail dot com> ---
Add a more meaningful case.

$cat p.cc
void a() { 
    auto var = [] (auto, volatile b) {};
}

$g++ p.cc
p.cc: In function ‘void a()’:
p.cc:2:35: error: ‘b’ does not name a type
    2 |     auto var = [] (auto, volatile b) {};
      |                                   ^
p.cc:2:40: error: expected ‘)’ before ‘;’ token
    2 |     auto var = [] (auto, volatile b) {};
      |                   ~                    ^
      |                                        )
p.cc:2:40: internal compiler error: in dependent_type_p, at cp/pt.c:26326
0x6c0f63 dependent_type_p(tree_node*)
        ../../gcc/cp/pt.c:26326

While in Clang
$clang++ p.cc
p.cc:2:35: error: unknown type name 'b'
    auto var = [] (auto, volatile b) {};
                                  ^
1 error generated.

Noted that why GCC emits "expected ‘)’ before ‘;’ token" and has an ICE on the
";"?

Also, this situation may happen in the real world when someone just leaves a
type specifier out by a mistake.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/95931] ICE in dependent_type_p, at cp/pt.c:26326
  2020-06-27  4:22 [Bug c++/95931] New: ICE in dependent_type_p, at cp/pt.c:26326 haoxintu at gmail dot com
  2020-07-03  4:04 ` [Bug c++/95931] " haoxintu at gmail dot com
@ 2020-10-29 15:10 ` mpolacek at gcc dot gnu.org
  2021-08-12 15:05 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-29 15:10 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Closing as a dup.

*** This bug has been marked as a duplicate of bug 96097 ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/95931] ICE in dependent_type_p, at cp/pt.c:26326
  2020-06-27  4:22 [Bug c++/95931] New: ICE in dependent_type_p, at cp/pt.c:26326 haoxintu at gmail dot com
  2020-07-03  4:04 ` [Bug c++/95931] " haoxintu at gmail dot com
  2020-10-29 15:10 ` mpolacek at gcc dot gnu.org
@ 2021-08-12 15:05 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12 15:05 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 101878 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-12 15:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27  4:22 [Bug c++/95931] New: ICE in dependent_type_p, at cp/pt.c:26326 haoxintu at gmail dot com
2020-07-03  4:04 ` [Bug c++/95931] " haoxintu at gmail dot com
2020-10-29 15:10 ` mpolacek at gcc dot gnu.org
2021-08-12 15:05 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).