This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53251] New: template keyword ignored between -> and member under name collision with non-member
- From: "potswa at mac dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 06 May 2012 00:51:06 +0000
- Subject: [Bug c++/53251] New: template keyword ignored between -> and member under name collision with non-member
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53251
Bug #: 53251
Summary: template keyword ignored between -> and member under
name collision with non-member
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: potswa@mac.com
Minimal testcase:
template< typename >
class set;
template< typename >
struct b {
template<typename T>
void set();
};
template<typename T>
struct d : b<T> {
d() { this->template set<int>(); }
};
int main()
{ d<int> s; }
Diagnostic:
In constructor âd<T>::d()â:
12:17: error: invalid use of âclass set<int>â
The name "set" is looked up in the context of the expression, outside the
class, perhaps per Â3.4.5/1 [basic.lookup.classref]. Furthermore, a class found
by lookup in expression scope per 3.4.5/1 must agree with lookup in class scope
anyway (i.e. it must be a base class if class scope lookup succeeds) or the
program is ill-formed.
3.4.5/1 does not apply because the template keyword is used to mark a dependent
object expression. I suspect that somehow the hint carried by the keyword isn't
properly restricting name lookup.
For deeper discussion see http://stackoverflow.com/questions/10426428 .