rsmith added a comment.

Have you considered modelling this as an attribute on the declaration of the 
variable instead of as a separate check? If so, why do you prefer this 
approach? (If I were to suggest this for standardization, an attribute is the 
approach I'd probably take.)


================
Comment at: lib/AST/Expr.cpp:2653-2662
@@ -2651,4 +2652,12 @@
     }
-
+    if (CE->getConstructor()->isConstexpr() &&
+        (CE->getConstructor()->getParent()->hasTrivialDestructor() ||
+            AllowNonLiteral)) {
+        for (auto *Arg : CE->arguments()) {
+          if (!Arg->isConstantInitializer(Ctx, false, Culprit))
+            return false;
+        }
+        return true;
+    }
     break;
   }
----------------
This doesn't look right: just because we're calling a constexpr constructor 
with constant arguments doesn't imply that the initializer is constant.


https://reviews.llvm.org/D23385



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to