public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43933]  New: Suboptimal error message when supplying a bad default value in initialization
@ 2010-04-29 11:56 bero at arklinux dot org
  2010-04-29 12:38 ` [Bug c++/43933] " redi at gcc dot gnu dot org
  2010-04-29 12:39 ` redi at gcc dot gnu dot org
  0 siblings, 2 replies; 6+ messages in thread
From: bero at arklinux dot org @ 2010-04-29 11:56 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]

When doing something like this:

class A {
    A();
    QString a;
};

A::A():a(0) {
}

The error message is


test.cpp: In constructor ‘ScribusDoc::ScribusDoc()’:                            
test.cpp:6:12: error: call of overloaded ‘QString(int)’ is ambiguous
/usr/lib64/qt4/include/QtCore/qstring.h:427:43: note: candidates are:
QString::QString(const QByteArray&)
/usr/lib64/qt4/include/QtCore/qstring.h:425:43: note:                
QString::QString(const char*)
/usr/lib64/qt4/include/QtCore/qstring.h:726:8: note:                
QString::QString(const QString&)
/usr/lib64/qt4/include/QtCore/qstring.h:106:5: note:                
QString::QString(QChar)
/usr/lib64/qt4/include/QtCore/qstring.h:105:14: note:                
QString::QString(const QChar*)


It would be useful if there was an indication of which initializer is being
processed at the time, e.g.

test.cpp: In constructor ‘ScribusDoc::ScribusDoc()’:                            
test.cpp:6:12: error: call of overloaded ‘QString(int)’ is ambiguous while
initializing member ‘a'
/usr/lib64/qt4/include/QtCore/qstring.h:427:43: note: candidates are:
QString::QString(const QByteArray&)
/usr/lib64/qt4/include/QtCore/qstring.h:425:43: note:                
QString::QString(const char*)
/usr/lib64/qt4/include/QtCore/qstring.h:726:8: note:                
QString::QString(const QString&)
/usr/lib64/qt4/include/QtCore/qstring.h:106:5: note:                
QString::QString(QChar)
/usr/lib64/qt4/include/QtCore/qstring.h:105:14: note:                
QString::QString(const QChar*)

especially if the class initializes tens of variables rather than just one.


-- 
           Summary: Suboptimal error message when supplying a bad default
                    value in initialization
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bero at arklinux dot org


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


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

end of thread, other threads:[~2021-06-25 17:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-43933-4@http.gcc.gnu.org/bugzilla/>
2021-06-20  9:08 ` [Bug c++/43933] Suboptimal error message when supplying a bad default value in initialization pinskia at gcc dot gnu.org
2021-06-20  9:10 ` pinskia at gcc dot gnu.org
2021-06-21 12:43 ` redi at gcc dot gnu.org
2021-06-25 17:24 ` redi at gcc dot gnu.org
2010-04-29 11:56 [Bug c++/43933] New: " bero at arklinux dot org
2010-04-29 12:38 ` [Bug c++/43933] " redi at gcc dot gnu dot org
2010-04-29 12:39 ` redi at gcc dot gnu dot 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).