public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "darlingmoff at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/51149] New: Smarter error output in a few template deduction/substitution failure cases
Date: Wed, 16 Nov 2011 05:19:00 -0000	[thread overview]
Message-ID: <bug-51149-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 51149
           Summary: Smarter error output in a few template
                    deduction/substitution failure cases
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: darlingmoff@gmail.com


I have a suggestion of making error output in two cases more helpful.  I've got
to admit that I don't know if there's a good way to implement this.

It's really nice that g++ makes suggestions, for when you're a little bit off
the mark.

But, there's two situations I tend to do all the time that cause several pages
of irrelevant suggestions/template failures fly by.  If you do several of these
at once, it takes a while to find the offending line numbers.  I often scroll
to top of errors, fix that line, try recompiling.  I'm not able to efficiently
pick out the line numbers all at once, since there's so much between the lines
I need to read.

I like the feature of g++ saying "maybe you meant ->" if you use "." on a
pointer.  If there would be a way to implement something like that on these
cases, it would be nice.


Case - When working a lot with streams, forgetting you're momentarily working
with a string
[example]string theString = anotherString << "text";  // note it should be
"+"[/example]

In this case, g++ gives many, many lines showing template argument
deduction/substitution failed, where if a single line would do that states
"maybe you meant + instead of <<".


Case - When meaning to call a lambda function, forgetting parenthesis
[example]auto lambda = [] { return "text"; };
if("text" == lambda) cout << "It's text" << endl;  // note it should be
"lambda()"[/example]

In this case, g++ gives many, many lines showing template argument
deduction/substitution failed, where if a single line would do that states
"maybe you forgot ()".


I do realize that the errors it gives are helpful in situations where someone
hasn't made one of these typos, so I realize that giving these shorter error
messages might be helpful to me, but less helpful to others.  That's why I said
I'm not sure if there's a good way to implement this, but I hope there is.


             reply	other threads:[~2011-11-16  3:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16  5:19 darlingmoff at gmail dot com [this message]
2011-11-16  8:27 ` [Bug c++/51149] " manu at gcc dot gnu.org
2011-11-16 12:38 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51149-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).