blob: 0fb7590c68b5754b8d8ded15cd1f4c8b74427806 [file] [log] [blame]
Sam Weinigce757a72010-01-16 21:21:01 +00001// Test this without pch.
Richard Smith762bb9d2011-10-13 22:29:44 +00002// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx_exprs.h -std=c++11 -fsyntax-only -verify %s -ast-dump
Sam Weinigce757a72010-01-16 21:21:01 +00003
Argyrios Kyrtzidis5e1b7c22010-06-24 08:57:09 +00004// Test with pch. Use '-ast-dump' to force deserialization of function bodies.
Richard Smith762bb9d2011-10-13 22:29:44 +00005// 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
Sam Weinigce757a72010-01-16 21:21:01 +00007
Andy Gibbs8e8fb3b2012-10-19 12:44:48 +00008// expected-no-diagnostics
9
Sam Weinigce757a72010-01-16 21:21:01 +000010int integer;
11double floating;
12char character;
Sam Weinigeb7f9612010-02-07 06:32:43 +000013bool boolean;
Sam Weinigce757a72010-01-16 21:21:01 +000014
15// CXXStaticCastExpr
16static_cast_result void_ptr = &integer;
17
18// CXXDynamicCastExpr
19Derived *d;
20dynamic_cast_result derived_ptr = d;
21
22// CXXReinterpretCastExpr
23reinterpret_cast_result void_ptr2 = &integer;
24
25// CXXConstCastExpr
26const_cast_result char_ptr = &character;
27
28// CXXFunctionalCastExpr
29functional_cast_result *double_ptr = &floating;
Sam Weinigeb7f9612010-02-07 06:32:43 +000030
31// CXXBoolLiteralExpr
32bool_literal_result *bool_ptr = &boolean;
33static_assert(true_value, "true_value is true");
34static_assert(!false_value, "false_value is false");
35
36// CXXNullPtrLiteralExpr
37cxx_null_ptr_result null_ptr = nullptr;
Chris Lattner14ab24f2010-05-09 06:03:39 +000038
39// CXXTypeidExpr
40typeid_result1 typeid_1 = 0;
Argyrios Kyrtzidis5e1b7c22010-06-24 08:57:09 +000041typeid_result2 typeid_2 = 0;
Eli Friedmanb3b6c222012-09-14 00:51:36 +000042
43// CharacterLiteral variants
44static_assert(char_value == 97, "char_value is correct");
45static_assert(wchar_t_value == 305, "wchar_t_value is correct");
46static_assert(char16_t_value == 231, "char16_t_value is correct");
47static_assert(char32_t_value == 8706, "char32_t_value is correct");