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
4
f()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 int v3 = arr(); // expected-error {{array types cannot be value-initialized}}
10 typedef void fn_ty();
11 fn_ty(); // expected-error {{function types cannot be value-initialized}}
12 int v4 = int();
13 int v5 = int; // expected-error {{expected '(' for function-style cast or type construction}}
14 typedef int T;
15 int *p;
16 bool v6 = T(0) == p;
17 #if __cplusplus >= 201103L
18 // expected-error@-2 {{comparison between pointer and integer ('T' (aka 'int') and 'int *')}}
19 #endif
20 char *str;
21 str = "a string";
22 #if __cplusplus <= 199711L
23 // expected-warning@-2 {{conversion from string literal to 'char *' is deprecated}}
24 #else
25 // expected-warning@-4 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
26 #endif
27 wchar_t *wstr;
28 wstr = L"a wide string";
29 #if __cplusplus <= 199711L
30 // expected-warning@-2 {{conversion from string literal to 'wchar_t *' is deprecated}}
31 #else
32 // expected-warning@-4 {{ISO C++11 does not allow conversion from string literal to 'wchar_t *'}}
33 #endif
34 }
35