Skip to content

Commit 528447f

Browse files
committed
[clang-tools-extra] the message in a static_assert is not always a string literal
Fixes build failure introduce by 47ccfd7.
1 parent 9324e1b commit 528447f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang-tools-extra/clang-tidy/modernize/UnaryStaticAssertCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ void UnaryStaticAssertCheck::registerMatchers(MatchFinder *Finder) {
2121
void UnaryStaticAssertCheck::check(const MatchFinder::MatchResult &Result) {
2222
const auto *MatchedDecl =
2323
Result.Nodes.getNodeAs<StaticAssertDecl>("static_assert");
24-
const StringLiteral *AssertMessage = MatchedDecl->getMessage();
24+
const auto *AssertMessage =
25+
dyn_cast_if_present<StringLiteral>(MatchedDecl->getMessage());
2526

2627
SourceLocation Loc = MatchedDecl->getLocation();
2728

0 commit comments

Comments
 (0)