Skip to content

Commit 96f0ab9

Browse files
committed
Recognize splices as parts of valid declaration specifiers.
Closes llvm#29.
1 parent f247b56 commit 96f0ab9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

clang/lib/Parse/ParseDecl.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5862,12 +5862,15 @@ bool Parser::isDeclarationSpecifier(
58625862
[[fallthrough]];
58635863
case tok::kw_decltype: // decltype(T())::type
58645864
case tok::kw_typename: // typename T::type
5865+
case tok::l_splice:
58655866
// Annotate typenames and C++ scope specifiers. If we get one, just
58665867
// recurse to handle whatever we get.
58675868
if (TryAnnotateTypeOrScopeToken(AllowImplicitTypename))
58685869
return true;
58695870
if (TryAnnotateTypeConstraint())
58705871
return true;
5872+
if (Tok.is(tok::annot_splice))
5873+
return true;
58715874
if (Tok.is(tok::identifier))
58725875
return false;
58735876

clang/test/Reflection/splice-types.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ consteval auto decr(typename [:r_int:] p) -> [:r_const_int:] {
7676
return p - 1;
7777
}
7878
static_assert(decr(13) == 12);
79+
80+
// 'typename' should be optional in parameter declarations.
81+
void fn([:r_int:]);
82+
class S { S([:r_int:]); };
7983
} // in_fn_defs
8084

8185
// ======

0 commit comments

Comments
 (0)