[OpenACC] Enable 'attach' clause for combined constructs
[llvm-project.git] / clang / test / SemaCXX / type-convert-construct.cpp
blob3db49cffa231a3d105e9b35e59361285e5eee44a
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++11 %s
5 void f() {
6 float v1 = float(1);
7 int v2 = typeof(int)(1,2); // expected-error {{excess elements in scalar initializer}}
8 typedef int arr[];
9 arr(); // expected-error {{array types cannot be value-initialized}}
10 typedef void fn_ty();
11 fn_ty(); // expected-error {{cannot create object of function type 'fn_ty'}}
12 fn_ty(0); // expected-error {{functional-style cast from 'int' to 'fn_ty'}}
13 fn_ty(0, 0); // expected-error {{cannot create object of function type 'fn_ty'}}
14 #if __cplusplus >= 201103L
15 fn_ty{}; // expected-error {{cannot create object of function type 'fn_ty'}}
16 fn_ty{0}; // expected-error {{cannot create object of function type 'fn_ty'}}
17 fn_ty{0, 0}; // expected-error {{cannot create object of function type 'fn_ty'}}
18 fn_ty({}); // expected-error {{cannot create object of function type 'fn_ty'}}
19 #endif
20 int v4 = int();
21 int v5 = int; // expected-error {{expected '(' for function-style cast or type construction}}
22 typedef int T;
23 int *p;
24 bool v6 = T(0) == p;
25 #if __cplusplus >= 201103L
26 // expected-error@-2 {{comparison between pointer and integer ('T' (aka 'int') and 'int *')}}
27 #endif
28 char *str;
29 str = "a string";
30 #if __cplusplus <= 199711L
31 // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}}
32 #else
33 // expected-warning@-4 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
34 #endif
35 wchar_t *wstr;
36 wstr = L"a wide string";
37 #if __cplusplus <= 199711L
38 // expected-warning@-2 {{conversion from string literal to 'wchar_t *' is deprecated}}
39 #else
40 // expected-warning@-4 {{ISO C++11 does not allow conversion from string literal to 'wchar_t *'}}
41 #endif