[cfe-commits] r81002 - /cfe/trunk/lib/AST/DeclCXX.cpp
Douglas Gregor
dgregor at apple.com
Fri Sep 4 07:46:40 PDT 2009
Author: dgregor
Date: Fri Sep 4 09:46:39 2009
New Revision: 81002
URL: http://llvm.org/viewvc/llvm-project?rev=81002&view=rev
Log:
When searching for a default constructor or copy constructor, skip constructor templates
Modified:
cfe/trunk/lib/AST/DeclCXX.cpp
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=81002&r1=81001&r2=81002&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Fri Sep 4 09:46:39 2009
@@ -157,6 +157,11 @@
DeclContext::lookup_const_iterator Con, ConEnd;
for (llvm::tie(Con, ConEnd) = this->lookup(ConstructorName);
Con != ConEnd; ++Con) {
+ // C++ [class.copy]p2:
+ // A non-template constructor for class X is a copy constructor if [...]
+ if (isa<FunctionTemplateDecl>(*Con))
+ continue;
+
if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context,
FoundTQs)) {
if (((TypeQuals & QualType::Const) == (FoundTQs & QualType::Const)) ||
@@ -301,6 +306,10 @@
DeclContext::lookup_const_iterator Con, ConEnd;
for (llvm::tie(Con, ConEnd) = lookup(ConstructorName);
Con != ConEnd; ++Con) {
+ // FIXME: In C++0x, a constructor template can be a default constructor.
+ if (isa<FunctionTemplateDecl>(*Con))
+ continue;
+
CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(*Con);
if (Constructor->isDefaultConstructor())
return Constructor;
More information about the cfe-commits
mailing list