This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/17413] New: diagnostic regression for local classes as template argument


Consider the following code

#include <algorithm>

int main()
{
   int a[10] = {0} ;

   struct T {
      void operator()(int) const { }
   };

   std::for_each(a, a + 10, T());
}

GCC-3.3.x used to say:

t.C: In function `int main()':
t.C:11: error: type `main()::T' composed from a local class is not a valid
   template-argument
t.C:11: error:   trying to instantiate `template<class _InputIter, class
   _Function> _Function std::for_each(_InputIter, _InputIter, _Function)'
t.C:11: error: no matching function for call to `for_each(int[10], int*,
   main()::T)'


Now, GCC-3.4.x says:

t.C: In function `int main()':
t.C:11: error: no matching function for call to `for_each(int[10], int*, main()\
::T)'


Notice that the most informative part of the diagnostic had been dropped,
leaving only the most cryptic, uninformative one.

-- 
           Summary: diagnostic regression for local classes as template
                    argument
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gdr at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: plateform independent


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]