summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-04-10 20:43:46 +0000
committerDouglas Gregor <dgregor@apple.com>2012-04-10 20:43:46 +0000
commit69a30b838c723cb1850de55cfa48a402cfeeb6e0 (patch)
tree9862f828934ae9c63773d3a3e57963327ada10bf /include
parentabf65ce5ddfb8db0d34280d30a91253930732f4f (diff)
When we determine that an initialization sequence failed due to an
incomplete type, keep track of the actual type that was incomplete. Otherwise, we might fail to produce a diagnostic. Fixes PR12498. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154432 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Sema/Initialization.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h
index 23cc4455db..4433843ff8 100644
--- a/include/clang/Sema/Initialization.h
+++ b/include/clang/Sema/Initialization.h
@@ -734,6 +734,9 @@ private:
/// \brief The candidate set created when initialization failed.
OverloadCandidateSet FailedCandidateSet;
+ /// \brief The incomplete type that caused a failure.
+ QualType FailedIncompleteType;
+
/// \brief Prints a follow-up note that highlights the location of
/// the initialized entity, if it's remote.
void PrintInitLocationNote(Sema &S, const InitializedEntity &Entity);
@@ -949,6 +952,8 @@ public:
void SetFailed(FailureKind Failure) {
SequenceKind = FailedSequence;
this->Failure = Failure;
+ assert((Failure != FK_Incomplete || !FailedIncompleteType.isNull()) &&
+ "Incomplete type failure requires a type!");
}
/// \brief Note that this initialization sequence failed due to failed
@@ -967,6 +972,13 @@ public:
return FailedOverloadResult;
}
+ /// \brief Note that this initialization sequence failed due to an
+ /// incomplete type.
+ void setIncompleteTypeFailure(QualType IncompleteType) {
+ FailedIncompleteType = IncompleteType;
+ SetFailed(FK_Incomplete);
+ }
+
/// \brief Determine why initialization failed.
FailureKind getFailureKind() const {
assert(Failed() && "Not an initialization failure!");