================
@@ -2133,6 +2142,18 @@ void 
CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) {
   for (conversion_iterator I = conversion_begin(), E = conversion_end();
        I != E; ++I)
     I.setAccess((*I)->getAccess());
+
+  ASTContext &Context = getASTContext();
+  if (!Context.getLangOpts().CPlusPlus20 && hasUserDeclaredConstructor()) {
+    // Diagnose any aggregate behavior changes in C++20
+    for (field_iterator I = field_begin(), E = field_end(); I != E; ++I) {
+      if (const auto *attr = I->getAttr<ExplicitAttr>()) {
+        Context.getDiagnostics().Report(
+            getLocation(), diag::warn_cxx20_compat_aggregate_init_with_ctors)
----------------
ilya-biryukov wrote:

Should we add a new warning here?
`"Attribute [[clang:...]] will have no effect in C++20 as the type will be 
non-aggregate due to user-declared constructors"`.
The wording for an existing attribute suggests there is already some 
initialization of this type happening, which is not necessarily the case.

https://github.com/llvm/llvm-project/pull/102040
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to