[cfe-commits] r131515 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Sean Hunt
scshunt at csclub.uwaterloo.ca
Tue May 17 18:06:46 PDT 2011
Author: coppro
Date: Tue May 17 20:06:45 2011
New Revision: 131515
URL: http://llvm.org/viewvc/llvm-project?rev=131515&view=rev
Log:
Force declaration of implicit members in C++0x mode.
I hear at least one person crying out in anguish, but it's unfortunately
necessary to avoid infinite loops with mutually dependent constructors
trying to call each other and determine if they are deleted.
It might be possible to go back to the old behavior if we can implement
part-of-file lookups efficiently, or if a solution is discovered by
which we can safely detect and avoid infinite recusion.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=131515&r1=131514&r2=131515&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue May 17 20:06:45 2011
@@ -2997,6 +2997,12 @@
// have inherited constructors.
DeclareInheritedConstructors(Record);
+ // Unfortunately, in C++0x mode, we additionally have to declare all
+ // implicit members in order to ensure we don't get a horrible evil bad
+ // infinite recursion from ShouldDelete*
+ if (getLangOptions().CPlusPlus0x)
+ ForceDeclarationOfImplicitMembers(Record);
+
CheckExplicitlyDefaultedMethods(Record);
}
@@ -3454,8 +3460,10 @@
}
bool Sema::ShouldDeleteCopyConstructor(CXXConstructorDecl *CD) {
- CXXRecordDecl *RD = CD->getParent();
+ CXXRecordDecl *RD = CD->getParent()->getDefinition();
assert(!RD->isDependentType() && "do deletion after instantiation");
+ assert(RD);
+ assert(CD->getParent() == RD);
if (!LangOpts.CPlusPlus0x)
return false;
More information about the cfe-commits
mailing list