public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/10864: [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates
@ 2003-05-20  0:39 bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2003-05-20  0:39 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, gdr, nobody

Synopsis: [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates

Responsible-Changed-From-To: unassigned->gdr
Responsible-Changed-By: bangerth
Responsible-Changed-When: Tue May 20 00:39:07 2003
Responsible-Changed-Why:
    Gaby wanted all diagnostic related bug reports, and ...
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue May 20 00:39:07 2003
State-Changed-Why:
    ... has already agreed to this particular one.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10864


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

* Re: c++/10864: [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates
@ 2003-05-20  3:16 Giovanni Bajo
  0 siblings, 0 replies; 4+ messages in thread
From: Giovanni Bajo @ 2003-05-20  3:16 UTC (permalink / raw)
  To: gdr; +Cc: gcc-prs

The following reply was made to PR c++/10864; it has been noted by GNATS.

From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-prs@gcc.gnu.org>,
	<gdr@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>,
	<gcc-gnats@gcc.gnu.org>,
	<bangerth@dealii.org>
Cc:  
Subject: Re: c++/10864: [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates
Date: Tue, 20 May 2003 05:06:51 +0200

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10864
 
 For reference:
 
 GCC with StlFilt:
 pr10864.cpp: In member function
    `bool less<X<vector<string>, vector<string> > >::foo()':
 pr10864.cpp:10:   instantiated from here
 pr10864.cpp:5: error: no match for
    `X<vector<string>, vector<string> > < X<vector<string>, vector<string> >'
     operator
 
 
 Comeau:
 "pr10864.cpp", line 5: error: no operator "<" matches these operands
             operand types are: X<std::vector<std::string,
                       std::allocator<std::string>>, std::vector<std::string,
                       std::allocator<std::string>>> <
                       X<std::vector<std::string,
 std::allocator<std::string>>,
                       std::vector<std::string, std::allocator<std::string>>>
         bool foo () { return T() < T(); }
                                  ^
 
           detected during instantiation of "bool less<T>::foo() [with
                     T=X<std::vector<std::string,
 std::allocator<std::string>>,
                     std::vector<std::string, std::allocator<std::string>>>]"
                     at line 10
 
 
 Comeau with StlFilt (yes, it screws indentation a little):
 pr10864.cpp(5): error: no operator "<" matches these operands
     operand types are: X<vector<string>, vector<string>> < X<vector<string>,
   vector<string>>
         bool foo () { return T() < T(); }
                                  ^
           detected during instantiation of "bool less<X<vector<string>,
    vector<string>>>::foo()" at line 10
 
 
 Giovanni Bajo
 


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

* Re: c++/10864: [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates
@ 2003-05-19 21:17 Gabriel Dos Reis
  0 siblings, 0 replies; 4+ messages in thread
From: Gabriel Dos Reis @ 2003-05-19 21:17 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10864; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: bangerth@dealii.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/10864: [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates
Date: 19 May 2003 23:08:18 +0200

 bangerth@dealii.org writes:
 
 | g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c y.cc
 | y.cc: In member function `bool less<T>::foo() [with T =
 |    X<std::vector<std::string, std::allocator<std::string> >,
 |    std::vector<std::string, std::allocator<std::string> > >]':
 | y.cc:10:   instantiated from here
 | y.cc:5: error: no match for `X<std::vector<std::string,
 |    std::allocator<std::string> >, std::vector<std::string,
 |    std::allocator<std::string> > > < X<std::vector<std::string,
 |    std::allocator<std::string> >, std::vector<std::string,
 |    std::allocator<std::string> > >' operator
 | 
 | Now, that's pretty hard to read. What it says is:
 |   no match for `A < B' operator
 | but the "<" is totally lost in all these template args.
 | I also always thought that the message was somehow
 | truncated, since usually in C++ there must be something
 | after the "operator" :-)
 
 I fully agree.  I must confess that I have never been sympathetic to
 the way we handle messages saying "no match for bubble[tangle] operator".
 Sometime, they just look very strange to read. 
 
 | I think it would be nice if the message could be changed
 | to read like
 |   no match for operator< in expression `A < B'
 | That way it would be simpler to figure out which operator
 | exactly is missing.
 
 I think that is a very good suggestion.
 
 -- Gaby


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

* c++/10864: [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates
@ 2003-05-19 15:16 bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2003-05-19 15:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10864
>Category:       c++
>Synopsis:       [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 19 15:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
present mainline
>Description:
This startled me, since I didn't see exactly what gcc
was complaining about -- I had code like
------------------------------
#include <string>
#include <vector>

template <class T> struct less {
  bool foo () { return T() < T(); }
};

template <typename,typename> class X {};
template struct less<X<std::vector<std::string>,
                       std::vector<std::string> > >;
-----------------------
(In fact it was even a little more complicated...). gcc
gives the following message (on mainline):

g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c y.cc
y.cc: In member function `bool less<T>::foo() [with T =
   X<std::vector<std::string, std::allocator<std::string> >,
   std::vector<std::string, std::allocator<std::string> > >]':
y.cc:10:   instantiated from here
y.cc:5: error: no match for `X<std::vector<std::string,
   std::allocator<std::string> >, std::vector<std::string,
   std::allocator<std::string> > > < X<std::vector<std::string,
   std::allocator<std::string> >, std::vector<std::string,
   std::allocator<std::string> > >' operator

Now, that's pretty hard to read. What it says is:
  no match for `A < B' operator
but the "<" is totally lost in all these template args.
I also always thought that the message was somehow
truncated, since usually in C++ there must be something
after the "operator" :-)

I think it would be nice if the message could be changed
to read like
  no match for operator< in expression `A < B'
That way it would be simpler to figure out which operator
exactly is missing.

W.


PS: As a heads up: this is what 2.95 produces on above 
code, which is way worse since it even states the
template args of the typedef expansion of std::string...

g/x> c++ -c y.cc
y.cc: In method `bool less<X<vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > >,vector<basic_string<char,string_char_traits<char
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
 >,__default_alloc_template<true,0> >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > > > >::foo()':
 y.cc:10:   instantiated from here
 y.cc:5: no match for `X<vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > >,vector<basic_string<char,string_char_traits<char>,__d efault_alloc_template<true,0> >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > > > < X<vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,allocator<basic_string<char,string_char _traits<char>,__default_alloc_template<true,0> > > >,vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > > >'


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

end of thread, other threads:[~2003-05-20  3:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-20  0:39 c++/10864: [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates bangerth
  -- strict thread matches above, loose matches on Subject: below --
2003-05-20  3:16 Giovanni Bajo
2003-05-19 21:17 Gabriel Dos Reis
2003-05-19 15:16 bangerth

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