[clang] [clang] Add tests for CWG issues regarding completeness of types (PR #92113)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 16:30:14 PDT 2024


================
@@ -86,6 +86,23 @@ struct A {
 };
 }
 
+namespace cwg1458 { // cwg1458: 3.1
+#if __cplusplus >= 201103L
+struct A;
+
+void f() {
+  constexpr A* a = nullptr;
+  constexpr int p = &*a;
+  // expected-error at -1 {{cannot initialize a variable of type 'const int' with an rvalue of type 'A *'}}
+  constexpr A *p2 = &*a;
----------------
shafik wrote:

So the DR says it is "unspecified" so are we documenting here that this will always be the behavior? Maybe worth a comment?

https://github.com/llvm/llvm-project/pull/92113


More information about the cfe-commits mailing list