Hi, The attached patch allows Clang to recover better from a missing 'typename' keyword in a function template definition:
<stdin>:1:29: error: missing 'typename' prior to dependent type name
'T::type'
template<typename T> void f(T::type) {}
^~~~~~~
typename
With this patch, we carry on disambiguating past such a situation. If we
can't disambiguate the declaration in some other way, the absence of
'typename' is used to infer that we have a variable declaration. I've also
extended the disambiguation code to inspect the token immediately after the
parameter-declaration-clause to disambiguate (in the above case, the
{token is used to disambiguate, and more generally we will also look
for an
exception-specification, ref-qualifier, cv-qualifier, etc., which cannot
appear after a parenthesized initializer in a variable declaration).
Does this seem like a reasonable approach?
Thanks!
Richard
missing-typename.diff
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
