Douglas Gregor | 53afad5 | 2011-07-29 01:08:54 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Argyrios Kyrtzidis | 987a14b | 2008-08-22 15:38:55 +0000 | [diff] [blame] | 2 | |
| 3 | void f() { |
| 4 | float v1 = float(1); |
Douglas Gregor | 19311e7 | 2010-09-08 21:40:08 +0000 | [diff] [blame] | 5 | int v2 = typeof(int)(1,2); // expected-error {{excess elements in scalar initializer}} |
Argyrios Kyrtzidis | 987a14b | 2008-08-22 15:38:55 +0000 | [diff] [blame] | 6 | typedef int arr[]; |
| 7 | int v3 = arr(); // expected-error {{array types cannot be value-initialized}} |
| 8 | int v4 = int(); |
| 9 | int v5 = int; // expected-error {{expected '(' for function-style cast or type construction}} |
Argyrios Kyrtzidis | 2fba121 | 2008-08-23 19:24:45 +0000 | [diff] [blame] | 10 | typedef int T; |
| 11 | int *p; |
| 12 | bool v6 = T(0) == p; |
Douglas Gregor | 77a5223 | 2008-09-12 00:47:35 +0000 | [diff] [blame] | 13 | char *str; |
Douglas Gregor | a9bff30 | 2010-02-28 18:30:25 +0000 | [diff] [blame] | 14 | str = "a string"; // expected-warning{{conversion from string literal to 'char *' is deprecated}} |
Douglas Gregor | 77a5223 | 2008-09-12 00:47:35 +0000 | [diff] [blame] | 15 | wchar_t *wstr; |
Douglas Gregor | a9bff30 | 2010-02-28 18:30:25 +0000 | [diff] [blame] | 16 | wstr = L"a wide string"; // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}} |
Argyrios Kyrtzidis | 987a14b | 2008-08-22 15:38:55 +0000 | [diff] [blame] | 17 | } |