Bug 87910 - Missing typename/template not diagnosed
Summary: Missing typename/template not diagnosed
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2018-11-06 20:36 UTC by Marek Polacek
Modified: 2021-08-04 17:31 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-08-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2018-11-06 20:36:45 UTC
While working on P0634 I noticed that the following testcase is accepted while it probably shouldn't be:

template<typename T> struct A {
  template<typename U> struct B;
  template<typename U> using C = U;
};

template<typename T> A<T>::B<T> f1();
template<typename T> A<T>::C<T> f2();

The dependent names "A<T>::B<T>" should be prefixed by the typename keyword, and the template keyword should come after ::.

With P0634 that typename will no longer be required[*] but I think it still requires "::template".

[*] it is a decl-specifier of the decl-specifier-seq of a simple-declaration or a function-definition in namespace scope
Comment 1 Marek Polacek 2020-03-24 17:21:11 UTC
This PR might get resolved by <https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542599.html>.
Comment 2 Andrew Pinski 2021-08-04 17:31:07 UTC
Confirmed.