This is an archive of the discontinued LLVM Phabricator instance.

[clang] Fix the bogus diagnostic introduced by the newly-added UsingTemplate Kind.
ClosedPublic

Authored by hokein on Apr 14 2022, 11:11 AM.

Diff Detail

Event Timeline

hokein created this revision.Apr 14 2022, 11:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2022, 11:11 AM
hokein requested review of this revision.Apr 14 2022, 11:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2022, 11:11 AM
sammccall accepted this revision.Apr 14 2022, 2:01 PM
sammccall added inline comments.
clang/lib/Sema/SemaDeclCXX.cpp
11014

I'd add here "The template name may not be qualified. [temp.deduct.guide]".

This is pretty important to the logic here and never explicitly written down.

11027

It's not quite clear what you're implying by this:

  • we want to allow qualified names, but they're not QualifiedTemplateNames? (this was my first reading)
  • we want to disallow qualified names, but don't have to worry about QualifiedTemplateNames.

The latter is correct, because the grammar only allows a simple-template-id (the name must be an identifier, no NNS allowed).

I'm not actually sure we want a comment here about qualified names at all - not including it in the || is correct whether or not it could occur here.

By the way, the following code is correctly rejected by clang, but accepted by GCC and MSVC:

namespace ns {
template <typename> class X {};
template <typename T> X(T) -> ns::X<T>;
}

(We're in the right scope, so this isn't just about secondary diagnostics)

11029

The meaning of this || is not clear.

Maybe bool SimplyWritten = ...?

Maybe also // A Using TemplateName can't actually be valid (either it's qualified, or we're in the wrong scope). But we have diagnosed these problems already.

This revision is now accepted and ready to land.Apr 14 2022, 2:01 PM
hokein updated this revision to Diff 462418.Sep 23 2022, 1:36 AM
hokein marked 3 inline comments as done.

rebase and address comments.