clang/test/SemaCXX/typeid-requires-typeinfo.cpp
raw| 1 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify=cxx20 -std=c++20 %s |
| 2 | // RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only -verify=cxx17 -std=c++17 %s |
| 3 | |
| 4 | class A{}; |
| 5 | |
| 6 | auto f() { |
| 7 | // cxx20-error@+2 {{you need to include <typeinfo> or import std before using the 'typeid' operator}} |
| 8 | // cxx17-error@+1 {{you need to include <typeinfo> before using the 'typeid' operator}} |
| 9 | return typeid(A); |
| 10 | } |