[PATCH] D136554: Implement CWG2631

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 06:23:56 PDT 2022


cor3ntin added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:507-508
   ``-std=gnu++14`` to their build settings to restore the previous behaviour.
+- Implemented DR2631. Invalid ``consteval`` calls in default arguments and default
+  member initializers are diagnosed when and if the default is used.
 
----------------
aaron.ballman wrote:
> Should this be listed as a potentially breaking change as this now 1) potentially changes the value people were getting for `source_location::current()` as a default argument, and 2) potentially causes instantiation differences due to the change in ODR use?
No because the current value of `source_location::current()` is invalid per library wording ( i should reference the issue though) and 2/ i don't think there are any difference in odr use except the point of diagnostic. Or at least i don't think you could observe it?


================
Comment at: clang/test/CXX/class/class.local/p1-0x.cpp:14
       int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing lambda expression}}
-    };
+    }c; // expected-note {{required here}}
   };
----------------
aaron.ballman wrote:
> Double-checking: you did intend to name that local variable, right?
Yes, that's actually the change I'm talking about,
That specific warning only triggers when the initializer is ODR used, which now only happens when a constructor is defined, which, in the case of aggregate, only happens on use of said aggregate.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136554/new/

https://reviews.llvm.org/D136554



More information about the cfe-commits mailing list