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

[temp.local]/3 Wrong example? #1900

Closed
timsong-cpp opened this issue Jan 18, 2018 · 1 comment
Closed

[temp.local]/3 Wrong example? #1900

timsong-cpp opened this issue Jan 18, 2018 · 1 comment
Assignees

Comments

@timsong-cpp
Copy link
Contributor

timsong-cpp commented Jan 18, 2018

template<class T, template<class> class U = T::template Base> struct Third { };
Third<Base<int> > t;                    // OK: default argument uses injected-class-name as a template

With T::template Base, lookup for Base in the scope of T aka Base<int> finds the injected-class-name, and this lookup does not ignore function names, so per CWG 1310 it should be considered to name the constructor of Base, making the code ill-formed.

If this analysis is correct, perhaps the example can be changed to

template<class T, template<class> class U = T::template Base> struct Third { };
Third<Derived<int> > t;                    // OK: default argument uses injected-class-name as a template
Third<Base<int> > t;                       // Error: injected-class-name in default argument names the constructor of Base ([class.qual])
@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Feb 13, 2018
@jensmaurer
Copy link
Member

MSVC rejects. ICC with different error messages. clang accepts with a warning.
Problem is T::template Base is a constructor name, even with intervening "template".
Editorial meeting consensus: Replace "Base" with "Derived", don't add a second line.

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Mar 16, 2018
@jensmaurer jensmaurer self-assigned this Mar 23, 2018
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

2 participants