summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-06-08 21:09:22 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-06-08 21:09:22 +0000
commit12f247f43f7c82c252b1c85b9a94f6494d362996 (patch)
treebfca3c75327b797a1369869d4a30f6e7ef2c5390 /clang/lib/AST/Decl.cpp
parent3293f460e7c413d68556457d1fbc2fad94a62afb (diff)
downloadbcm5719-llvm-12f247f43f7c82c252b1c85b9a94f6494d362996.tar.gz
bcm5719-llvm-12f247f43f7c82c252b1c85b9a94f6494d362996.zip
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
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp7
1 files changed, 7 insertions, 0 deletions
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<CXXConstructorDecl>(this);
+ if (IC && CD)
+ CD->getParent()->markedConstructorConstexpr(CD);
+}
+
bool FunctionDecl::isMain() const {
const TranslationUnitDecl *tunit =
dyn_cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext());
OpenPOWER on IntegriCloud