From 12f247f43f7c82c252b1c85b9a94f6494d362996 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 8 Jun 2012 21:09:22 +0000 Subject: PR13051: If a constructor is explicitly defaulted, it isn't marked as being constexpr until we get to the end of the class definition. When that happens, be sure to remember that the class actually does have a constexpr constructor. This is a stopgap solution, which still doesn't cover the case of a class with multiple copy constructors (only some of which are constexpr). We should be performing constructor lookup when implicitly defining a constructor in order to determine whether all constructors it invokes are constexpr. llvm-svn: 158228 --- clang/lib/AST/Decl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/lib/AST/Decl.cpp') diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 1d5ff10f7b5..ee90b23e5c2 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -1684,6 +1684,13 @@ void FunctionDecl::setPure(bool P) { Parent->markedVirtualFunctionPure(); } +void FunctionDecl::setConstexpr(bool IC) { + IsConstexpr = IC; + CXXConstructorDecl *CD = dyn_cast(this); + if (IC && CD) + CD->getParent()->markedConstructorConstexpr(CD); +} + bool FunctionDecl::isMain() const { const TranslationUnitDecl *tunit = dyn_cast(getDeclContext()->getRedeclContext()); -- cgit v1.2.3