[Clang] A lone [
does not an attribute make (#147306)
In some tentative parses, we would always consider `[` as the start of an attribute - only `[[` should be. Fixes #63880
This commit is contained in:
parent
39ea9b71d9
commit
78e84e5779
@ -932,6 +932,7 @@ Bug Fixes to C++ Support
|
||||
through its address (``(&Foo::bar<baz>)()``).
|
||||
- Correctly handle allocations in the condition of a ``if constexpr``.(#GH120197) (#GH134820)
|
||||
- Fixed a crash when handling invalid member using-declaration in C++20+ mode. (#GH63254)
|
||||
- Fixed parsing of lambda expressions that appear after ``*`` or ``&`` in contexts where a declaration can appear. (#GH63880)
|
||||
- Fix name lookup in lambda appearing in the body of a requires expression. (#GH147650)
|
||||
- Fix a crash when trying to instantiate an ambiguous specialization. (#GH51866)
|
||||
- Improved handling of variables with ``consteval`` constructors, to
|
||||
|
@ -735,10 +735,12 @@ bool Parser::TrySkipAttributes() {
|
||||
tok::kw_alignas) ||
|
||||
Tok.isRegularKeywordAttribute()) {
|
||||
if (Tok.is(tok::l_square)) {
|
||||
if (!NextToken().is(tok::l_square))
|
||||
return true;
|
||||
|
||||
ConsumeBracket();
|
||||
if (Tok.isNot(tok::l_square))
|
||||
return false;
|
||||
ConsumeBracket();
|
||||
|
||||
if (!SkipUntil(tok::r_square) || Tok.isNot(tok::r_square))
|
||||
return false;
|
||||
// Note that explicitly checking for `[[` and `]]` allows to fail as
|
||||
|
@ -159,3 +159,15 @@ struct U {
|
||||
template <typename T>
|
||||
void m_fn1(T x = 0[0); // expected-error{{expected ']'}} expected-note{{to match this '['}}
|
||||
} *U;
|
||||
|
||||
|
||||
|
||||
namespace GH63880{
|
||||
void f() {
|
||||
char* i(*[] { return new int; }());
|
||||
// expected-error@-1{{cannot initialize a variable of type 'char *' with an lvalue of type 'int'}}
|
||||
|
||||
char* j(&[]() -> int& { return *new int; }());
|
||||
//expected-error@-1{{cannot initialize a variable of type 'char *' with an rvalue of type 'int *'}}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user