Bug 59173 - [11/12/13/14 Regression] Alias template in partial specialization finds name from primary template
Summary: [11/12/13/14 Regression] Alias template in partial specialization finds name ...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.2
: P3 normal
Target Milestone: 11.5
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2013-11-18 13:34 UTC by John Spicer
Modified: 2023-07-07 07:26 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.9.0, 7.5.0, 9.3.0, 9.4.0
Known to fail: 10.1.0, 10.5.0, 13.1.1, 4.8.5
Last reconfirmed: 2013-11-20 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Spicer 2013-11-18 13:34:00 UTC
In code such as the following, which is present in the <ext/extptr_allocator.h> and <ext/pointer.h> headers, the type in the alias template definition finds the rebind from the primary template.  The correct behavior is to give an error because "rebind<_Up>" should be preceded by the "template" keyword for syntactic disambiguation.

This is also a defect in those two headers as the template keyword should be added there.

template<typename _Ptr>
struct pointer_traits
{
  template<typename _Up> struct rebind {};
};

template<typename T> struct P {};

template<typename T>
struct pointer_traits<P<T> >
{
  template<typename _Up>
     using rebind = P<typename pointer_traits<T>::rebind<_Up>>;
};
Comment 1 Jonathan Wakely 2013-11-18 14:43:32 UTC
Thanks for the report, John. I'll fix the library parts (assuming the corrected versions still compile with G++)
Comment 2 Paolo Carlini 2013-11-18 14:44:31 UTC
It does, AFAICS.
Comment 3 Jonathan Wakely 2013-11-20 13:39:35 UTC
Author: redi
Date: Wed Nov 20 13:39:33 2013
New Revision: 205114

URL: http://gcc.gnu.org/viewcvs?rev=205114&root=gcc&view=rev
Log:
	PR c++/59173
	* include/ext/pointer.h (pointer_traits<>::rebind<>): Add template
	keyword in nested name.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/ext/pointer.h
Comment 4 Jonathan Wakely 2013-11-20 13:42:51 UTC
John, I only found one problem in <ext/pointer.h>. Was the error in <ext/extptr_allocator.h> due to including <ext/pointer.h>?

Confirming as a front-end bug anyway.
Comment 5 Andrew Pinski 2021-08-02 02:47:17 UTC
So this was fixed in 4.9 and then broke again in GCC 10 so it is a regression.
Comment 6 Jakub Jelinek 2022-06-28 10:30:41 UTC
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Comment 7 Richard Biener 2023-07-07 07:26:07 UTC
The testcase is still accepted.