// Test this without pch. // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx_exprs.h -std=c++11 -fsyntax-only -verify %s -ast-dump | FileCheck %s // Test with pch. Use '-ast-dump' to force deserialization of function bodies. // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -x c++-header -std=c++11 -emit-pch -o %t %S/cxx_exprs.h // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-dump-all | FileCheck %s // expected-no-diagnostics int integer; double floating; char character; bool boolean; // CXXStaticCastExpr static_cast_result void_ptr = &integer; // CHECK: TypedefDecl {{.*}} <{{.*}}, col:{{.*}}> col:{{.*}}{{(imported)?}} referenced static_cast_result 'typeof (static_cast(0))':'void *'{{$}} // CHECK-NEXT: TypeOfExprType {{.*}} 'typeof (static_cast(0))' sugar{{( imported)?}}{{$}} // CHECK-NEXT: ParenExpr {{.*}} 'void *'{{$}} // CHECK-NEXT: CXXStaticCastExpr {{.*}} 'void *' static_cast {{$}} // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void *' part_of_explicit_cast{{$}} // CHECK-NEXT: IntegerLiteral {{.*}} 'int' 0{{$}} // CXXDynamicCastExpr Derived *d; dynamic_cast_result derived_ptr = d; // CHECK: TypedefDecl {{.*}} <{{.*}}, col:{{.*}}> col:{{.*}} referenced dynamic_cast_result 'typeof (dynamic_cast(base_ptr))':'Derived *'{{$}} // CHECK-NEXT: TypeOfExprType {{.*}} 'typeof (dynamic_cast(base_ptr))' sugar{{( imported)?}}{{$}} // CHECK-NEXT: ParenExpr {{.*}} 'Derived *'{{$}} // CHECK-NEXT: CXXDynamicCastExpr {{.*}} 'Derived *' dynamic_cast {{$}} // CHECK-NEXT: ImplicitCastExpr {{.*}} 'Base *' part_of_explicit_cast{{$}} // CHECK-NEXT: DeclRefExpr {{.*}} 'Base *' lvalue Var {{.*}} 'base_ptr' 'Base *' non_odr_use_unevaluated{{$}} // CXXReinterpretCastExpr reinterpret_cast_result void_ptr2 = &integer; // CHECK: TypedefDecl {{.*}} <{{.*}}, col:{{.*}}> col:{{.*}} referenced reinterpret_cast_result 'typeof (reinterpret_cast(0))':'void *'{{$}} // CHECK-NEXT: TypeOfExprType {{.*}} 'typeof (reinterpret_cast(0))' sugar{{( imported)?}}{{$}} // CHECK-NEXT: ParenExpr {{.*}} 'void *'{{$}} // CHECK-NEXT: CXXReinterpretCastExpr {{.*}} 'void *' reinterpret_cast {{$}} // CHECK-NEXT: IntegerLiteral {{.*}} 'int' 0{{$}} // CXXConstCastExpr const_cast_result char_ptr = &character; // CHECK: TypedefDecl {{.*}} <{{.*}}, col:{{.*}}> col:{{.*}} referenced const_cast_result 'typeof (const_cast(const_char_ptr_value))':'char *'{{$}} // CHECK-NEXT: TypeOfExprType {{.*}} 'typeof (const_cast(const_char_ptr_value))' sugar{{( imported)?}}{{$}} // CHECK-NEXT: ParenExpr {{.*}} 'char *'{{$}} // CHECK-NEXT: CXXConstCastExpr {{.*}} 'char *' const_cast {{$}} // CHECK-NEXT: ImplicitCastExpr {{.*}} 'const char *' part_of_explicit_cast{{$}} // CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' lvalue Var {{.*}} 'const_char_ptr_value' 'const char *' non_odr_use_unevaluated{{$}} // CXXFunctionalCastExpr functional_cast_result *double_ptr = &floating; // CHECK: TypedefDecl {{.*}} <{{.*}}, col:{{.*}}> col:{{.*}} referenced functional_cast_result 'typeof (double(int_value))':'double'{{$}} // CHECK-NEXT: TypeOfExprType {{.*}} 'typeof (double(int_value))' sugar{{( imported)?}}{{$}} // CHECK-NEXT: ParenExpr {{.*}} 'double'{{$}} // CHECK-NEXT: CXXFunctionalCastExpr {{.*}} 'double' functional cast to double {{$}} // CHECK-NEXT: ImplicitCastExpr {{.*}} 'double' part_of_explicit_cast{{$}} // CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' part_of_explicit_cast{{$}} // CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'int_value' 'int' non_odr_use_unevaluated{{$}} // CXXBoolLiteralExpr bool_literal_result *bool_ptr = &boolean; static_assert(true_value, "true_value is true"); static_assert(!false_value, "false_value is false"); // CXXNullPtrLiteralExpr cxx_null_ptr_result null_ptr = nullptr; // CXXTypeidExpr typeid_result1 typeid_1 = 0; typeid_result2 typeid_2 = 0; // CharacterLiteral variants static_assert(char_value == 97, "char_value is correct"); static_assert(wchar_t_value == 305, "wchar_t_value is correct"); static_assert(char16_t_value == 231, "char16_t_value is correct"); static_assert(char32_t_value == 8706, "char32_t_value is correct");