patch: clarify missing template arguments when parsing base specifier

Nick Lewycky nlewycky at google.com
Mon Aug 26 22:38:19 PDT 2013


We currently just emit "expected class name" if the base specifier names a
template-id without a template argument list. This patch changes that error
to say "expected template argument list after template-id". Fixes PR8382!
Please review.

There is a secondary side-effect with the interaction with typo correction
which is partly undesirable (too verbose) and partly better (typo
correction is performed). On this testcase:

template <typename T> class Foo {}; class Bar : public Foox {};

before my patch, clang emits:

a.cc:1:56: error: expected class name
[point at 'Foox']

and with my patch clang emits:

a.cc:1:56: error: no template named 'Foox'; did you mean 'Foo'?
template <typename T> class Foo {}; class Bar : public Foox {};
[point at 'Foox' suggest 'Foo']
a.cc:1:29: note: 'Foo' declared here
template <typename T> class Foo {}; class Bar : public Foox {};
[point at 'Foo']
a.cc:1:56: error: expected template argument list after template-id
template <typename T> class Foo {}; class Bar : public Foox {};
[point at 'Foox']

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130826/e88a95ce/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr8382-1.patch
Type: application/octet-stream
Size: 2328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130826/e88a95ce/attachment.obj>


More information about the cfe-commits mailing list