summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTImporter.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2016-02-24 20:58:14 +0000
committerNico Weber <nicolasweber@gmx.de>2016-02-24 20:58:14 +0000
commit72c57f49c4b5638626f5a6ff91187f33976c321f (patch)
tree3d8c99b1f56ff215647d1c013746fd6ced3faf02 /clang/lib/AST/ASTImporter.cpp
parent57ca270b7abcf143f7931d39b36c38455022ec0f (diff)
downloadbcm5719-llvm-72c57f49c4b5638626f5a6ff91187f33976c321f.tar.gz
bcm5719-llvm-72c57f49c4b5638626f5a6ff91187f33976c321f.zip
Fix rejects-valid caused by r261297.
r261297 called hasUserProvidedDefaultConstructor() to check if defining a const object is ok. This is incorrect for this example: struct X { template<typename ...T> X(T...); int n; }; const X x; // formerly OK, now bogus error Instead, track if a class has a defaulted default constructor, and disallow a const object for classes that either have defaulted default constructors or if they need an implicit constructor. Bug report and fix approach by Richard Smith, thanks! llvm-svn: 261770
Diffstat (limited to 'clang/lib/AST/ASTImporter.cpp')
-rw-r--r--clang/lib/AST/ASTImporter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 1ea44fe6006..d6b9424fb4d 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -2040,6 +2040,8 @@ bool ASTNodeImporter::ImportDefinition(RecordDecl *From, RecordDecl *To,
ToData.HasIrrelevantDestructor = FromData.HasIrrelevantDestructor;
ToData.HasConstexprNonCopyMoveConstructor
= FromData.HasConstexprNonCopyMoveConstructor;
+ ToData.HasDefaultedDefaultConstructor
+ = FromData.HasDefaultedDefaultConstructor;
ToData.DefaultedDefaultConstructorIsConstexpr
= FromData.DefaultedDefaultConstructorIsConstexpr;
ToData.HasConstexprDefaultConstructor
OpenPOWER on IntegriCloud