From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16404 invoked by alias); 19 May 2003 15:16:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 16378 invoked by uid 71); 19 May 2003 15:16:00 -0000 Resent-Date: 19 May 2003 15:16:00 -0000 Resent-Message-ID: <20030519151600.16377.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, bangerth@dealii.org Received: (qmail 6499 invoked by uid 48); 19 May 2003 15:12:37 -0000 Message-Id: <20030519151237.6498.qmail@sources.redhat.com> Date: Mon, 19 May 2003 15:16:00 -0000 From: bangerth@dealii.org Reply-To: bangerth@dealii.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10864: [diagnostic] Unreadable error message for "no match for 'A < B' operator" if A,B are templates X-SW-Source: 2003-05/txt/msg02092.txt.bz2 List-Id: >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 #include template struct less { bool foo () { return T() < T(); } }; template class X {}; template struct less, std::vector > >; ----------------------- (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::foo() [with T = X >, std::vector > >]': y.cc:10: instantiated from here y.cc:5: error: no match for `X >, std::vector > > < X >, std::vector > >' 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,__default_alloc_template >,allocator,__default_alloc_template > > >,vectorHow-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: >,__default_alloc_template >,allocator,__default_alloc_template > > > > >::foo()': y.cc:10: instantiated from here y.cc:5: no match for `X,__default_alloc_template >,allocator,__default_alloc_template > > >,vector,__d efault_alloc_template >,allocator,__default_alloc_template > > > > < X,__default_alloc_template >,allocator,__default_alloc_template > > >,vector,__default_alloc_template >,allocator,__default_alloc_template > > > >'