aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-08-24 15:23:48 +0000
committerDouglas Gregor <dgregor@apple.com>2009-08-24 15:23:48 +0000
commit5842ba9fd482bb2fe5198b32c2ae549cd5474e6d (patch)
tree5eb6082ee5fcb3648d63fb7ee4398da2607c949a /lib/Sema/SemaType.cpp
parent19b7b158699983e70693c73f3b982fd16c056585 (diff)
Try to complete a type before looking for conversion functions within
that type. Note that we do not produce a diagnostic if the type is incomplete; rather, we just don't look for conversion functions. Fixes PR4660. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79919 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index db01ad094e..49946ac1c3 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1752,7 +1752,8 @@ void Sema::ProcessTypeAttributeList(QualType &Result, const AttributeList *AL) {
///
/// @param diag The diagnostic value (e.g.,
/// @c diag::err_typecheck_decl_incomplete_type) that will be used
-/// for the error message if @p T is incomplete.
+/// for the error message if @p T is incomplete. If 0, no diagnostic will be
+/// emitted.
///
/// @param Range1 An optional range in the source code that will be a
/// part of the "incomplete type" error message.
@@ -1792,7 +1793,8 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag,
if (Loc.isValid())
ClassTemplateSpec->setLocation(Loc);
return InstantiateClassTemplateSpecialization(ClassTemplateSpec,
- /*ExplicitInstantiation=*/false);
+ /*ExplicitInstantiation=*/false,
+ /*Complain=*/diag != 0);
}
} else if (CXXRecordDecl *Rec
= dyn_cast<CXXRecordDecl>(Record->getDecl())) {
@@ -1805,11 +1807,15 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag,
Spec = dyn_cast<ClassTemplateSpecializationDecl>(Parent);
assert(Spec && "Not a member of a class template specialization?");
return InstantiateClass(Loc, Rec, Pattern, Spec->getTemplateArgs(),
- /*ExplicitInstantiation=*/false);
+ /*ExplicitInstantiation=*/false,
+ /*Complain=*/diag != 0);
}
}
}
+ if (diag == 0)
+ return true;
+
if (PrintType.isNull())
PrintType = T;