void Parser::CheckForTemplateAndDigraph(Token &Next, ParsedType ObjectType,
bool EnteringContext,
IdentifierInfo &II, CXXScopeSpec &SS) {
- if (!Next.is(tok::l_square) || !Next.getLength() == 2)
+ if (!Next.is(tok::l_square) || Next.getLength() != 2)
return;
Token SecondToken = GetLookAheadToken(2);
(void)static_cast LCC c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
}
-template <class T> class D {};
+ // This note comes from "::D[:F> A5;"
+template <class T> class D {}; // expected-note{{template is declared here}}
template <class T> void E() {};
class F {};
D< ::F> A4;
::E< ::F>();
E< ::F>();
+
+ // Make sure that parser doesn't expand '[:' to '< ::'
+ ::D[:F> A5; // expected-error {{cannot refer to class template 'D' without a template argument list}} \
+ // expected-error {{expected expression}} \
+ // expected-error {{expected ']'}} \
+ // expected-note {{to match this '['}}
}