public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45490]  New: Confusing error message for local type arguments
@ 2010-09-01 21:34 giecrilj at stegny dot 2a dot pl
  2010-09-01 21:36 ` [Bug c++/45490] " pinskia at gcc dot gnu dot org
  2010-09-01 21:37 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 4+ messages in thread
From: giecrilj at stegny dot 2a dot pl @ 2010-09-01 21:34 UTC (permalink / raw)
  To: gcc-bugs

#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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/45490] Confusing error message for local type arguments
  2010-09-01 21:34 [Bug c++/45490] New: Confusing error message for local type arguments giecrilj at stegny dot 2a dot pl
@ 2010-09-01 21:36 ` pinskia at gcc dot gnu dot org
  2010-09-01 21:37 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-01 21:36 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 586 bytes --]



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-09-01 21:36 -------
On the trunk we get:

t.cc: In function ‘void foo()’:
t.cc:9:39: error: no matching function for call to ‘distance(foo()::my_iter,
foo()::my_iter)’
/home/apinski/local-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_iterator_base_funcs.h:111:59:
note: candidate is: template<class _InputIterator> typename
std::iterator_traits::difference_type std::distance(_InputIterator,
_InputIterator)


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/45490] Confusing error message for local type arguments
  2010-09-01 21:34 [Bug c++/45490] New: Confusing error message for local type arguments giecrilj at stegny dot 2a dot pl
  2010-09-01 21:36 ` [Bug c++/45490] " pinskia at gcc dot gnu dot org
@ 2010-09-01 21:37 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-01 21:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2010-09-01 21:37 -------
Not to mention it is accepted with -std=c++0x as local types in C++0x can be
now template arguments.


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/45490] Confusing error message for local type arguments
       [not found] <bug-45490-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-01  0:05 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-10-01  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|x86_64-suse-linux           |
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.10.01 00:04:46
               Host|x86_64-suse-linux           |
     Ever Confirmed|0                           |1
              Build|x86_64-suse-linux           |

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-10-01 00:04:46 UTC ---
Even though we now print out the candidates, I think we could print out that
the templates don't match local types.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-01  0:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-01 21:34 [Bug c++/45490] New: Confusing error message for local type arguments giecrilj at stegny dot 2a dot pl
2010-09-01 21:36 ` [Bug c++/45490] " pinskia at gcc dot gnu dot org
2010-09-01 21:37 ` pinskia at gcc dot gnu dot org
     [not found] <bug-45490-4@http.gcc.gnu.org/bugzilla/>
2010-10-01  0:05 ` pinskia at gcc dot gnu.org

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