public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52974] New: Canonicalize include paths in diagnostics
@ 2012-04-13 13:16 redi at gcc dot gnu.org
  2012-04-13 13:17 ` [Bug c++/52974] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-13 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52974
           Summary: Canonicalize include paths in diagnostics
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org
                CC: manu@gcc.gnu.org


#include <algorithm>
void f() { std::sort(1); }

The diagnostics caused by misuse of the standard library are ridiculous:


t.cc: In function 'void f()':
t.cc:2:23: error: no matching function for call to 'sort(int)'
t.cc:2:23: note: candidates are:
In file included from
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/algorithm:63:0,
                 from t.cc:1:
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_algo.h:5420:5:
note: template<class _RAIter> void std::sort(_RAIter, _RAIter)
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_algo.h:5420:5:
note:   template argument deduction/substitution failed:
t.cc:2:23: note:   candidate expects 2 arguments, 1 provided
In file included from
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/algorithm:63:0,
                 from t.cc:1:
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_algo.h:5456:5:
note: template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter,
_Compare)
/home/redi/gcc/4.x/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/bits/stl_algo.h:5456:5:
note:   template argument deduction/substitution failed:
t.cc:2:23: note:   candidate expects 3 arguments, 1 provided

Users don't care that the include path is
$PREFIX/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0

The paths should be canonicalized using realpath(3) to simply
/home/redi/gcc/4.x/include/c++/4.8.0/algorithm and
/home/redi/gcc/4.x/include/c++/4.8.0/bits/stl_algo.h

This probably isn't a good idea for user headers, as the include path they use
with -I should be preserved so they recognise it, but for GCC's own C++ headers
(and possibly all system headers?) it would be a huge improvement.


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

end of thread, other threads:[~2012-05-02 23:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 13:16 [Bug c++/52974] New: Canonicalize include paths in diagnostics redi at gcc dot gnu.org
2012-04-13 13:17 ` [Bug c++/52974] " redi at gcc dot gnu.org
2012-04-13 13:43 ` manu at gcc dot gnu.org
2012-04-13 13:55 ` redi at gcc dot gnu.org
2012-04-15 15:32 ` manu at gcc dot gnu.org
2012-04-15 15:32 ` manu at gcc dot gnu.org
2012-04-15 18:33 ` redi at gcc dot gnu.org
2012-04-30 17:02 ` manu at gcc dot gnu.org
2012-04-30 17:04 ` redi at gcc dot gnu.org
2012-04-30 17:20 ` manu at gcc dot gnu.org
2012-05-02 23:05 ` redi 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).