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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-04-15
                 CC|                            |manu at gcc dot gnu.org,
                   |                            |paolo.carlini at oracle dot
                   |                            |com
     Ever Confirmed|0                           |1

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-15 
17:05:31 UTC ---
This is what Clang prints:

In file included from pr39728.C:1:
In file included from /usr/include/c++/4.3/fstream:44:
In file included from /usr/include/c++/4.3/istream:44:
In file included from /usr/include/c++/4.3/ios:49:
In file included from /usr/include/c++/4.3/bits/basic_ios.h:474:
/usr/include/c++/4.3/bits/basic_ios.tcc:182:25: error: 'operator=' is a private
member of 'std::ios_base'
  extern template class basic_ios<char>;
                        ^
/usr/include/c++/4.3/bits/ios_base.h:785:5: note: declared private here
    operator=(const ios_base&);
    ^
/usr/include/c++/4.3/iosfwd:57:11: note: implicit default copy assignment
operator for 'std::basic_ios<char>' first required here
    class basic_istream;
          ^
/usr/include/c++/4.3/bits/fstream.tcc:914:25: note: implicit default copy
assignment operator for 'std::basic_istream<char>' first required here
  extern template class basic_ifstream<char>;
                        ^
/usr/include/c++/4.3/bits/fstream.tcc:913:25: error: 'operator=' is a private
member of 'std::basic_streambuf<char>'
  extern template class basic_filebuf<char>;
                        ^
/usr/include/c++/4.3/streambuf:782:7: note: declared private here
      operator=(const __streambuf_type&) { return *this; };
      ^
/usr/include/c++/4.3/bits/fstream.tcc:914:25: note: implicit default copy
assignment operator for 'std::basic_filebuf<char>' first required here
  extern template class basic_ifstream<char>;
                        ^
pr39728.C:10:5: note: implicit default copy assignment operator for
'std::basic_ifstream<char>' first required here
  y = x;
    ^
2 errors generated.


Even with canonicalized paths, GCC diagnostic is awful. Several things wrong:

* Do not show "In member function", it clutters the output and it is duplicated
info because they are already mentioned in the note. 

* What is a "synthesized method"? Where this term comes from? Is this something
that an average C++ programmer can understand?

* Avoid monsters like "std::basic_streambuf<_CharT, _Traits>::__streambuf_type&
std::basic_streambuf<_CharT, _Traits>::operator=(const __streambuf_type&) [with
_CharT = char; _Traits = std::char_traits<char>; std::basic_streambuf<_CharT,
_Traits>::__streambuf_type = std::basic_streambuf<char>]"

Following Ian's suggestion, it would be amazing if GCC emitted:

pr39728.C:10:5: error: cannot call implicit default copy assignment operator
for 'std::basic_ifstream<char>'
                note: candidates are:
/usr/include/c++/4.3/streambuf:782:7: note: candidate #1 is implicit default
copy assignment operator for 'std::basic_filebuf<char>'
[...............] note: cannot be called because [reason]

/usr/include/c++/4.3/streambuf:782:7: note: candidate #1 is implicit default
copy assignment operator for 'std::basic_filebuf<char>'
[...............] note: cannot be called because [reason]

/usr/include/c++/4.3/bits/fstream.tcc:914:25: note: candidate #2 is implicit
default copy assignment operator for 'std::basic_istream<char>'
[...............] note: cannot be called because [reason]


I am sorry, I don't have time to fix all this, but I wish we had enough
developers to fix it, because it is a shame.

Reply via email to