2010-01-17 05:21:01 +08:00
|
|
|
// Test this without pch.
|
2011-10-14 06:29:44 +08:00
|
|
|
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx_exprs.h -std=c++11 -fsyntax-only -verify %s -ast-dump
|
2010-01-17 05:21:01 +08:00
|
|
|
|
2010-06-24 16:57:09 +08:00
|
|
|
// Test with pch. Use '-ast-dump' to force deserialization of function bodies.
|
2011-10-14 06:29:44 +08:00
|
|
|
// 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
|
2010-01-17 05:21:01 +08:00
|
|
|
|
2012-10-19 20:44:48 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
|
2010-01-17 05:21:01 +08:00
|
|
|
int integer;
|
|
|
|
double floating;
|
|
|
|
char character;
|
2010-02-07 14:32:43 +08:00
|
|
|
bool boolean;
|
2010-01-17 05:21:01 +08:00
|
|
|
|
|
|
|
// CXXStaticCastExpr
|
|
|
|
static_cast_result void_ptr = &integer;
|
|
|
|
|
|
|
|
// CXXDynamicCastExpr
|
|
|
|
Derived *d;
|
|
|
|
dynamic_cast_result derived_ptr = d;
|
|
|
|
|
|
|
|
// CXXReinterpretCastExpr
|
|
|
|
reinterpret_cast_result void_ptr2 = &integer;
|
|
|
|
|
|
|
|
// CXXConstCastExpr
|
|
|
|
const_cast_result char_ptr = &character;
|
|
|
|
|
|
|
|
// CXXFunctionalCastExpr
|
|
|
|
functional_cast_result *double_ptr = &floating;
|
2010-02-07 14:32:43 +08:00
|
|
|
|
|
|
|
// 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;
|
2010-05-09 14:03:39 +08:00
|
|
|
|
|
|
|
// CXXTypeidExpr
|
|
|
|
typeid_result1 typeid_1 = 0;
|
2010-06-24 16:57:09 +08:00
|
|
|
typeid_result2 typeid_2 = 0;
|
2012-09-14 08:51:36 +08:00
|
|
|
|
|
|
|
// 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");
|