xref: /llvm-project/clang/test/CXX/drs/cwg492.cpp (revision 463e61a0013253bec1b5e7f07e7b1803b68e2b3d)
1ed128c7dSVlad Serebrennikov // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
2ed128c7dSVlad Serebrennikov // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
3ed128c7dSVlad Serebrennikov // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
4ed128c7dSVlad Serebrennikov // RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
5ed128c7dSVlad Serebrennikov // RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
6ed128c7dSVlad Serebrennikov // RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
7ed128c7dSVlad Serebrennikov // RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
8ed128c7dSVlad Serebrennikov 
9ed128c7dSVlad Serebrennikov #if __cplusplus == 199711L
10ed128c7dSVlad Serebrennikov #define NOTHROW throw()
11ed128c7dSVlad Serebrennikov #else
12ed128c7dSVlad Serebrennikov #define NOTHROW noexcept(true)
13ed128c7dSVlad Serebrennikov #endif
14ed128c7dSVlad Serebrennikov 
15ed128c7dSVlad Serebrennikov namespace std {
16ed128c7dSVlad Serebrennikov struct type_info {
17ed128c7dSVlad Serebrennikov   const char* name() const NOTHROW;
18ed128c7dSVlad Serebrennikov };
19*463e61a0SVlad Serebrennikov } // namespace std
20ed128c7dSVlad Serebrennikov 
21ed128c7dSVlad Serebrennikov namespace cwg492 { // cwg492: 2.7
22ed128c7dSVlad Serebrennikov 
23ed128c7dSVlad Serebrennikov void f() {
24ed128c7dSVlad Serebrennikov   typeid(int).name();
25ed128c7dSVlad Serebrennikov   typeid(const int).name();
26ed128c7dSVlad Serebrennikov   typeid(volatile int).name();
27ed128c7dSVlad Serebrennikov   typeid(const volatile int).name();
28ed128c7dSVlad Serebrennikov }
29ed128c7dSVlad Serebrennikov 
30ed128c7dSVlad Serebrennikov } // namespace cwg492
31ed128c7dSVlad Serebrennikov 
32ed128c7dSVlad Serebrennikov // CHECK-LABEL: define {{.*}} void @cwg492::f()()
33ed128c7dSVlad Serebrennikov // CHECK:         {{.*}} = call {{.*}} @std::type_info::name() const({{.*}} @typeinfo for int)
34ed128c7dSVlad Serebrennikov // CHECK-NEXT:    {{.*}} = call {{.*}} @std::type_info::name() const({{.*}} @typeinfo for int)
35ed128c7dSVlad Serebrennikov // CHECK-NEXT:    {{.*}} = call {{.*}} @std::type_info::name() const({{.*}} @typeinfo for int)
36ed128c7dSVlad Serebrennikov // CHECK-NEXT:    {{.*}} = call {{.*}} @std::type_info::name() const({{.*}} @typeinfo for int)
37ed128c7dSVlad Serebrennikov // CHECK-LABEL: }
38