Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CWG2974 [temp.deduct.type] Missing non-deduced context for nested-name-specifier of qualified-id of a template #660

Open
hubert-reinterpretcast opened this issue Dec 27, 2024 · 2 comments

Comments

@hubert-reinterpretcast
Copy link

Full name of submitter (unless configured in github; will be published with the issue): Hubert Tong

Reference (section label): temp.deduct.type

Link to reflector thread (if any): N/A

Issue description:
https://wg21.link/temp.deduct.type#5.1 has, as a non-deduced context,

This does not cover templates named using a qualified-id. There is implementation divergence:

template <template <typename> class>
struct B;

struct C {
  template <typename>
  struct Nested;
};

template <typename T>
void f(T *, B<T::template Nested> *);

void g(C *cp) {
  f(cp, 0);  // Clang rejects; `T::` in the declaration of `f` is not a non-deduced context
}

Online compiler link: https://godbolt.org/z/8sTvW7W94

Suggested resolution:
Modify https://wg21.link/temp.deduct.type#5.1:

  • The nested-name-specifier of a type or template that was specified using a qualified-id.
@frederick-vs-ja
Copy link

Actually, Clang can't deduce T from B<T::template Nested>* either (demo). So I think all investigated implementations agree with the proposed wording, and the apparent divergence is just due to a bug of Clang.

@jensmaurer
Copy link
Member

CWG2974

@jensmaurer jensmaurer changed the title [temp.deduct.type] Missing non-deduced context for nested-name-specifier of qualified-id of a template CWG2974 [temp.deduct.type] Missing non-deduced context for nested-name-specifier of qualified-id of a template Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants