Author: Aaron Ballman Date: 2024-06-24T09:50:37-04:00 New Revision: 3ff680a1a57d74a5c94d3da35594a8046a879888
URL: https://github.com/llvm/llvm-project/commit/3ff680a1a57d74a5c94d3da35594a8046a879888 DIFF: https://github.com/llvm/llvm-project/commit/3ff680a1a57d74a5c94d3da35594a8046a879888.diff LOG: [C11] Claim we do not conform to WG14 N1285 yet This also updates the status for C11 to be Partial, and because C17 is C11 plus DR resolutions, that makes C17 also Partial. Added: clang/test/C/C11/n1285.c Modified: clang/www/c_status.html Removed: ################################################################################ diff --git a/clang/test/C/C11/n1285.c b/clang/test/C/C11/n1285.c new file mode 100644 index 0000000000000..e7a9463e68103 --- /dev/null +++ b/clang/test/C/C11/n1285.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -verify=wrong -std=c99 %s +// RUN: %clang_cc1 -verify=wrong -std=c11 %s +// RUN: %clang_cc1 -verify=cpp -std=c++11 -x c++ %s + +/* WG14 N1285: No + * Extending the lifetime of temporary objects (factored approach) + * + * NB: we do not properly materialize temporary expressions in situations where + * it would be expected; that is why the "no-diagnostics" marking is named + * "wrong". We do issue the expected diagnostic in C++ mode. + */ + +// wrong-no-diagnostics + +struct X { int a[5]; }; +struct X f(void); + +int foo(void) { + // FIXME: This diagnostic should be issued in C11 as well (though not in C99, + // as this paper was a breaking change between C99 and C11). + 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}} + return *p; +} + diff --git a/clang/www/c_status.html b/clang/www/c_status.html index d71d4c216f744..922a84ca34312 100644 --- a/clang/www/c_status.html +++ b/clang/www/c_status.html @@ -57,12 +57,12 @@ <h1>C Support in Clang</h1> <tr> <td><a href="#c11">C11</a></td> <td><tt>-std=c11</tt></td> - <td class="unknown" align="center">Probably</td> + <td class="partial" align="center">Partial</td> </tr> <tr> <td><a href="#c17">C17</a></td> <td><tt>-std=c17</tt></td> - <td class="unknown" align="center">Maybe?</td> + <td class="partial" align="center">Partial</td> </tr> <tr> <td><a href="#c2x">C23</a></td> @@ -425,7 +425,7 @@ <h2 id="c11">C11 implementation status</h2> <tr> <td>Extending the lifetime of temporary objects (factored approach)</td> <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1285.htm">N1285</a></td> - <td class="unknown" align="center">Unknown</td> + <td class="none" align="center">No</td> </tr> <tr> <td>Requiring signed char to have no padding bits</td> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits