public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39728] New: C++ diagnostic for private operator= is voluminous and unhelpful
@ 2009-04-10 20:16 ian at airs dot com
2009-04-16 18:22 ` [Bug c++/39728] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: ian at airs dot com @ 2009-04-10 20:16 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4429 bytes --]
For this test case:
# include <fstream>
# include <istream>
using namespace std;
ifstream x;
ifstream& y = x;
int main(int argc, char** argv) {
y = x;
return 0;
}
current mainline g++ produces:
In file included from
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/ios:39,
from
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/istream:40,
from
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/fstream:40,
from foo.cc:1:
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/bits/ios_base.h:
In member function std::basic_ios<char>& std::basic_ios<char>::operator=(const
std::basic_ios<char>&):
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/bits/ios_base.h:793:
error: std::ios_base& std::ios_base::operator=(const std::ios_base&) is
private
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/iosfwd:47:
error: within this context
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/iosfwd:
In member function std::basic_istream<char>&
std::basic_istream<char>::operator=(const std::basic_istream<char>&):
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/iosfwd:53:
note: synthesized method std::basic_ios<char>&
std::basic_ios<char>::operator=(const std::basic_ios<char>&) first required
here
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/iosfwd:
In member function std::basic_ifstream<char>&
std::basic_ifstream<char>::operator=(const std::basic_ifstream<char>&):
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/iosfwd:81:
note: synthesized method std::basic_istream<char>&
std::basic_istream<char>::operator=(const std::basic_istream<char>&) first
required here
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/streambuf:
In member function std::basic_filebuf<char>&
std::basic_filebuf<char>::operator=(const std::basic_filebuf<char>&):
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/streambuf:778:
error: std::basic_streambuf<_CharT, _Traits>::__streambuf_type&
std::basic_streambuf<_CharT, _Traits>::operator=(const
std::basic_streambuf<_CharT, _Traits>::__streambuf_type&) [with _CharT = char,
_Traits = std::char_traits<char>, std::basic_streambuf<_CharT,
_Traits>::__streambuf_type = std::basic_streambuf<char>] is private
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/iosfwd:78:
error: within this context
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/iosfwd:
In member function std::basic_ifstream<char>&
std::basic_ifstream<char>::operator=(const std::basic_ifstream<char>&):
/home/iant/gcc/install/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../../include/c++/4.5.0/iosfwd:81:
note: synthesized method std::basic_filebuf<char>&
std::basic_filebuf<char>::operator=(const std::basic_filebuf<char>&) first
required here
foo.cc: In function int main(int, char**):
foo.cc:10: note: synthesized method std::basic_ifstream<char>&
std::basic_ifstream<char>::operator=(const std::basic_ifstream<char>&) first
required here
Walking back from the point of error to the point of use can be helpful in some
scenarios. However, for an example like this one it is unhelpful and serves to
disguise the real problem.
I think we can use the walkback more intelligently and say something like:
foo.cc:10: error: cannot synthesize method std::basic_ifstream<char>&
std::basic_ifstream<char>::operator=(const std::basic_ifstream<char>&)
foo.cc:10: note: because std::ios_base& std::ios_base::operator=(const
std::ios_base&) is private
foo.cc:10: note: for details use -fvery-long-error-messages
--
Summary: C++ diagnostic for private operator= is voluminous and
unhelpful
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ian at airs dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39728
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/39728] C++ diagnostic for private operator= is voluminous and unhelpful
2009-04-10 20:16 [Bug c++/39728] New: C++ diagnostic for private operator= is voluminous and unhelpful ian at airs dot com
@ 2009-04-16 18:22 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-16 18:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2009-04-16 18:22 -------
I think libstdc++ include pathes make the error message useless but if the
user code had the same walking back, I think the user would say this is more
useful message than what is recommended in comment #0 (at least by default).
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Keywords| |diagnostic
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39728
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-16 18:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-10 20:16 [Bug c++/39728] New: C++ diagnostic for private operator= is voluminous and unhelpful ian at airs dot com
2009-04-16 18:22 ` [Bug c++/39728] " pinskia 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).