Home | History | Annotate | Download | only in PCH
      1 // Test this without pch.
      2 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx_exprs.h -std=c++11 -fsyntax-only -verify %s -ast-dump
      3 
      4 // Test with pch. Use '-ast-dump' to force deserialization of function bodies.
      5 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -x c++-header -std=c++11 -emit-pch -o %t %S/cxx_exprs.h
      6 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-dump
      7 
      8 // expected-no-diagnostics
      9 
     10 int integer;
     11 double floating;
     12 char character;
     13 bool boolean;
     14 
     15 // CXXStaticCastExpr
     16 static_cast_result void_ptr = &integer;
     17 
     18 // CXXDynamicCastExpr
     19 Derived *d;
     20 dynamic_cast_result derived_ptr = d;
     21 
     22 // CXXReinterpretCastExpr
     23 reinterpret_cast_result void_ptr2 = &integer;
     24 
     25 // CXXConstCastExpr
     26 const_cast_result char_ptr = &character;
     27 
     28 // CXXFunctionalCastExpr
     29 functional_cast_result *double_ptr = &floating;
     30 
     31 // CXXBoolLiteralExpr
     32 bool_literal_result *bool_ptr = &boolean;
     33 static_assert(true_value, "true_value is true");
     34 static_assert(!false_value, "false_value is false");
     35 
     36 // CXXNullPtrLiteralExpr
     37 cxx_null_ptr_result null_ptr = nullptr;
     38 
     39 // CXXTypeidExpr
     40 typeid_result1 typeid_1 = 0;
     41 typeid_result2 typeid_2 = 0;
     42 
     43 // CharacterLiteral variants
     44 static_assert(char_value == 97, "char_value is correct");
     45 static_assert(wchar_t_value == 305, "wchar_t_value is correct");
     46 static_assert(char16_t_value == 231, "char16_t_value is correct");
     47 static_assert(char32_t_value == 8706, "char32_t_value is correct");
     48