1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -O0 -verify -Wno-vla %s
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -pedantic-errors -O0 -verify=pe %s
4 // expected-no-diagnostics
6 extern "C" int printf(const char*, ...);
10 S() __attribute__ ((nothrow
)) { printf("%d: S()\n", ++N
); }
11 ~S() __attribute__ ((nothrow
)) { printf("%d: ~S()\n", N
--); }
15 void print(int n
, int a
, int b
, int c
, int d
) {
16 printf("n=%d\n,sizeof(S)=%d\nsizeof(array_t[0][0])=%d\nsizeof(array_t[0])=%d\nsizeof(array_t)=%d\n",
22 S array_t
[n
][n
+1]; // pe-error 2{{variable length arrays in C++ are a Clang extension}} pe-note 2{{parameter}} pe-note@-1 2{{here}}
23 int sizeof_S
= sizeof(S
);
24 int sizeof_array_t_0_0
= sizeof(array_t
[0][0]);
25 int sizeof_array_t_0
= sizeof(array_t
[0]);
26 int sizeof_array_t
= sizeof(array_t
);
27 print(n
, sizeof_S
, sizeof_array_t_0_0
, sizeof_array_t_0
, sizeof_array_t
);
35 printf("exception %d\n", e
);
40 printf("exception %d", e
);