[Bug c++/95931] ICE in dependent_type_p, at cp/pt.c:26326

haoxintu at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 3 04:04:11 GMT 2020


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.


More information about the Gcc-bugs mailing list