Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / clang / test / C / C11 / n1285.c
blobe7a9463e68103acacb407f0d90aca3a7c92bd26a
1 // RUN: %clang_cc1 -verify=wrong -std=c99 %s
2 // RUN: %clang_cc1 -verify=wrong -std=c11 %s
3 // RUN: %clang_cc1 -verify=cpp -std=c++11 -x c++ %s
5 /* WG14 N1285: No
6 * Extending the lifetime of temporary objects (factored approach)
8 * NB: we do not properly materialize temporary expressions in situations where
9 * it would be expected; that is why the "no-diagnostics" marking is named
10 * "wrong". We do issue the expected diagnostic in C++ mode.
13 // wrong-no-diagnostics
15 struct X { int a[5]; };
16 struct X f(void);
18 int foo(void) {
19 // FIXME: This diagnostic should be issued in C11 as well (though not in C99,
20 // as this paper was a breaking change between C99 and C11).
21 int *p = f().a; // cpp-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
22 return *p;