#include <algorithm>

void foo (void) 
{ 
class my_iter: 
 public std:: iterator <std:: random_access_iterator_tag, int > 
 { public: operator int * (void) const { return NULL; }}; 

std:: distance (my_iter (), my_iter ()); }

Compiling this code, you get:

error: no matching function for call to &#8216;distance(foo()::my_iter,
foo()::my_iter)&#8217;

This message is highly confusing.

Both Intel and Comeau give the following message:

a template argument may not reference a local type

(Microsoft groks the construct all right.)


-- 
           Summary: Confusing error message for local type arguments
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: giecrilj at stegny dot 2a dot pl
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


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

Reply via email to