Template code that used to work prior to gcc-3.4
fails in very uninformative ways. Diagnostic should
be improved. 

For example:

$ cat t.cpp
  template <class T> struct A { T t; };
  // Swap following 2 functions to get conforming C++
  template <class T> void foo(const A<T>& data)
  {
    foo((int)data.t); 
  }
  void foo(int data);

$ g++ t2.cpp
  t2.cpp: In function `void foo(const A<T>&)':
  t2.cpp:5: error: no matching function for call to `foo(int&)'

As an exaple for a good diagnostic:
  int f()
  {
    for (int i=0 ; i < 4 ; ++i)
    {}
    return i;
  }

t4.cpp: In function `int f()':
t4.cpp:5: name lookup of `i' changed for new ISO `for' scoping
t4.cpp:3:   using obsolete binding at `i'


It would be nice to have something like:


  t2.cpp: In function `void foo(const A<T>&)':
  t2.cpp:5: error: name lookup of `foo(int&)' changed for new ISO `template'
functions.
  t2.cpp:9: error: using not dependent `foo(int)' is no longer supported.

-- 
           Summary: Uninformative diagnostic for name lookup from template
                    function
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: veksler at il dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to