[Bug c++/20516] New: Function names affect template compilation

topiolli at ee dot oulu dot fi gcc-bugzilla@gcc.gnu.org
Thu Mar 17 12:28:00 GMT 2005


The following code compiles if (and only if) the global function name and A's
member function name are identical. It shouldn't, because a.template should be
used inside the test() function in the global scope.

template <class T> class A
{
public:
  template <class U> void test(T value) {}
};

template <class T> void test(A<T>& a, T val)
{
  a.test<int>(val); //should be a.template test<int>(val);
}

int main()
{
}

-- 
           Summary: Function names affect template compilation
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: topiolli at ee dot oulu dot fi
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: 3.4.1-4mdk
  GCC host triplet: Mandrakelinux 10.1
GCC target triplet: i586


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20516



More information about the Gcc-bugs mailing list