[PATCH] D20428: Tracking exception specification source locations
don hinton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 30 22:39:47 PST 2016
hintonda added a comment.
The problem is that when a noexcept(bool expr) specification is invalid, e.g., bad bool expr, the NoexceptType in Parser::tryParseExceptionSpecification is set to EST_None and returned. This will mean the FunctionDecl type won't have an exception TypeLoc, but the TypeSourceInfo type in ASTContext::adjustExceptionSpec will, which will trigger the assert in due to different sizes.
The easy fix is to set NoexceptType = EST_BasicNoexcept which will cause all tests to pass. The other option would be to leave it as EST_ComputedNoexcept, but that would cause a crash later during template instantiation.
Here's a patch (not sure I can uploade it):
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 4002b09..7cfb8d5 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -3545,7 +3545,7 @@ Parser::tryParseExceptionSpecification(bool Delayed,
Actions.CheckBooleanCondition(KeywordLoc, NoexceptExpr.get());
NoexceptRange = SourceRange(KeywordLoc, T.getCloseLocation());
} else {
- NoexceptType = EST_None;
+ NoexceptType = EST_BasicNoexcept;
}
} else {
// There is no argument.
https://reviews.llvm.org/D20428
More information about the cfe-commits
mailing list