clang/test/SemaCXX/pr50497-crash-typeid.cpp
raw| 1 | // RUN: %clang_cc1 -verify %s -Wno-unevaluated-expression |
| 2 | // Don't crash (PR50497). |
| 3 | |
| 4 | // expected-no-diagnostics |
| 5 | namespace std { |
| 6 | class type_info; |
| 7 | } |
| 8 | |
| 9 | class Ex { |
| 10 | // polymorphic |
| 11 | virtual ~Ex(); |
| 12 | }; |
| 13 | void Frob(const std::type_info &type); |
| 14 | |
| 15 | void Foo(Ex *ex) { |
| 16 | // generic lambda |
| 17 | [=](auto rate) { |
| 18 | // typeid |
| 19 | Frob(typeid(*ex)); |
| 20 | }(1); |
| 21 | |
| 22 | [=](auto rate) { |
| 23 | // unevaluated nested typeid |
| 24 | Frob(typeid((typeid(*ex), ex))); |
| 25 | }(1); |
| 26 | } |