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

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).