public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55668] New: Incorrect lookup for template member of dependent template
@ 2012-12-13 1:04 tudorb at fb dot com
2012-12-13 1:24 ` [Bug c++/55668] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: tudorb at fb dot com @ 2012-12-13 1:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55668
Bug #: 55668
Summary: Incorrect lookup for template member of dependent
template
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: tudorb@fb.com
The following correct program gives an error; it appears that "a.template
foo<0>" looks up foo in global scope and fails because it believes that foo
takes a class first template argument instead of an int.
// The bug is not triggered if the template below is missing,
// or if it is a class or function or global variable instead of
// a template.
template <class T> class foo;
template <int N> struct A {
template <int K> void foo(int val) { }
};
template <int N> struct B {
// The bug is not triggered if "bar" is named "foo"
void bar() {
a.template foo<0>(42);
}
// This has to depend on N; A<0> doesn't trigger the bug
A<N> a;
};
The error I get:
d.cpp: In member function `void B<N>::bar()`:
d.cpp:13:21: error: type/value mismatch at argument 1 in template parameter
list for `template<class T> class foo`
d.cpp:13:21: error: expected a type, got `0`
Broken in 4.1.2, 4.6.2, 4.7.1 (the three versions I have access to).
(The bug was minimized from actual code, in which the method in question was
named "set" and collided with std::set, as we had "using std::set")
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55668] Incorrect lookup for template member of dependent template
2012-12-13 1:04 [Bug c++/55668] New: Incorrect lookup for template member of dependent template tudorb at fb dot com
@ 2012-12-13 1:24 ` pinskia at gcc dot gnu.org
2012-12-13 1:28 ` tudorb at fb dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-12-13 1:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55668
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-12-13 01:24:35 UTC ---
I think there is a dup of this bug somewhere. Related to how sometimes we
don't need to use template in some cases.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55668] Incorrect lookup for template member of dependent template
2012-12-13 1:04 [Bug c++/55668] New: Incorrect lookup for template member of dependent template tudorb at fb dot com
2012-12-13 1:24 ` [Bug c++/55668] " pinskia at gcc dot gnu.org
@ 2012-12-13 1:28 ` tudorb at fb dot com
2012-12-13 10:40 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: tudorb at fb dot com @ 2012-12-13 1:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55668
--- Comment #2 from Tudor Bosman <tudorb at fb dot com> 2012-12-13 01:28:05 UTC ---
It's hard to believe that I'm the first one to hit this problem, but my 10
minutes of searching haven't found any duplicates; perhaps my search-fu isn't
up to par :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55668] Incorrect lookup for template member of dependent template
2012-12-13 1:04 [Bug c++/55668] New: Incorrect lookup for template member of dependent template tudorb at fb dot com
2012-12-13 1:24 ` [Bug c++/55668] " pinskia at gcc dot gnu.org
2012-12-13 1:28 ` tudorb at fb dot com
@ 2012-12-13 10:40 ` redi at gcc dot gnu.org
2012-12-13 18:01 ` tudorb at fb dot com
2012-12-13 18:02 ` tudorb at fb dot com
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2012-12-13 10:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55668
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-12-13 10:40:23 UTC ---
Very similar to PR 55576, the name foo<0> should be looked up in the scope of
A<N>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55668] Incorrect lookup for template member of dependent template
2012-12-13 1:04 [Bug c++/55668] New: Incorrect lookup for template member of dependent template tudorb at fb dot com
` (2 preceding siblings ...)
2012-12-13 10:40 ` redi at gcc dot gnu.org
@ 2012-12-13 18:01 ` tudorb at fb dot com
2012-12-13 18:02 ` tudorb at fb dot com
4 siblings, 0 replies; 6+ messages in thread
From: tudorb at fb dot com @ 2012-12-13 18:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55668
--- Comment #4 from Tudor Bosman <tudorb at fb dot com> 2012-12-13 18:01:04 UTC ---
Jonathan: thanks, yes, that looks like a dup. Closing this one.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/55668] Incorrect lookup for template member of dependent template
2012-12-13 1:04 [Bug c++/55668] New: Incorrect lookup for template member of dependent template tudorb at fb dot com
` (3 preceding siblings ...)
2012-12-13 18:01 ` tudorb at fb dot com
@ 2012-12-13 18:02 ` tudorb at fb dot com
4 siblings, 0 replies; 6+ messages in thread
From: tudorb at fb dot com @ 2012-12-13 18:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55668
Tudor Bosman <tudorb at fb dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
--- Comment #5 from Tudor Bosman <tudorb at fb dot com> 2012-12-13 18:01:42 UTC ---
Jonathan: thanks, yes, that looks like a dup. Closing this one.
*** This bug has been marked as a duplicate of bug 55576 ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-12-13 18:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-13 1:04 [Bug c++/55668] New: Incorrect lookup for template member of dependent template tudorb at fb dot com
2012-12-13 1:24 ` [Bug c++/55668] " pinskia at gcc dot gnu.org
2012-12-13 1:28 ` tudorb at fb dot com
2012-12-13 10:40 ` redi at gcc dot gnu.org
2012-12-13 18:01 ` tudorb at fb dot com
2012-12-13 18:02 ` tudorb at fb dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).