[PATCH] PR16909: Diagnose missing 'typename' on dependent template

Richard Smith richard at metafoo.co.uk
Wed Feb 18 17:09:12 PST 2015

Makes sense to me. I'm not too unhappy about the class.qual p2 case; it's
not ideal, but the new diagnostic explains one way to fix the problem,
which is in some sense an improvement, and it only arises if the user makes
several errors all at once. A FIXME in the test would be nice, though.

Should we also diagnose the missing 'template' keyword? (I'd note that
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1710 removes
the need for that keyword here, but isn't fully baked yet).

More generally, should we rebuild the whole nested name specifier as a
dependent specifier, rather than just the last component?

On Mon, Jan 26, 2015 at 9:08 AM, Ben Langmuir <blangmuir at apple.com> wrote:

> This patch diagnoses a missing ‘typename’ keyword on nested template types
> like A<T>::B<U>, to fix llvm.org/pr16909. In addition to fixing an
> accepts-invalid, in C++11 such types would cause assertion failures and/or
> invalid LLVM IR when used with ‘auto’.
> I’m not 100% sure if the changes to
> test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp are
> desirable, or if we should suppress the missing ‘typename’ diagnostic when
> we’re already recovering on X<T>::X<T>.  I’m open to suggestions :-)
> Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150218/4ee2fc5e/attachment.html>

More information about the cfe-commits mailing list