public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51149] New: Smarter error output in a few template deduction/substitution failure cases
@ 2011-11-16  5:19 darlingmoff at gmail dot com
  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
  0 siblings, 2 replies; 3+ messages in thread
From: darlingmoff at gmail dot com @ 2011-11-16  5:19 UTC (permalink / raw)
  To: gcc-bugs

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.


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

end of thread, other threads:[~2011-11-16 11:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-16  5:19 [Bug c++/51149] New: Smarter error output in a few template deduction/substitution failure cases darlingmoff at gmail dot com
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

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