[Bug c++/52801] improve selective typedef unwrapping

2018-08-20 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52801

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords|error-recovery  |
 CC|redi at gcc dot gnu.org|

--- Comment #4 from Jonathan Wakely  ---
The only real difference between Clang and G++ here is that Clang preserves the
vector type in the output, but G++ shows vector.

GCC's first line shows the 

52801.cc:9:8: error: no match for ‘operator=’ (operand types are
‘std::__cxx11::string {aka std::__cxx11::basic_string}’ and
‘std::vector’)

This uses "aka" to relate the type shown in the source (which might be a
typedef) with the canonical types shown in the later errors. If that first line
said "'vector' {aka 'std::vector'}" I think it would be fine.

The fact the typedef is preserved for the string but not the vector may be
because the string is declared using a typedef ("string") but the vector is not
("Real" is a typedef, but "vector" is not).


Some of the other differences are due to comparing apples with oranges:

- Several more lines in GCC output, because the clang test was done with
-std=gnu++98 and the GCC one with -std=gnu++14, so there are extra overloads in
the GCC version. Clang also prints more lines for recent standards.

- Clang shows std::basic_string and gcc shows
std::__cxx11::basic_string, but only because the clang test was using GCC
4.3 headers. Using libc++ headers shows std::__1::basic_string which is
no better. N.B. GCC would be improved by PR 81239, so that the first line would
show "std::string {aka 'std::__cxx11::basic_string'}". I might even be able to
make that happen with a libstdc++ change.

[Bug c++/52801] improve selective typedef unwrapping

2017-08-19 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52801

--- Comment #3 from Jonathan Wakely  ---
(In reply to Manuel López-Ibáñez from comment #2)
> (In reply to Eric Gallager from comment #1)
> > Confirmed that the notes could ease up on the template spew; g++ output is
> > now:
> 
> Note that I'm not complaining about the redundant notes listing the
> declaration of the candidates (which are the subject of a different PR that
> I cannot find right now). 
> 
> The object of improvement here is:
> 
> no known conversion from 'vector' to 'const std::basic_string'
> 
> versus
>  
> no known conversion for argument 1 from ‘std::vector’ to ‘const
> std::__cxx11::basic_string&’
> 
> On the latter, gcc is excessively unwrapping typedef.

There's no typedef involved in those string types (well there is, as it should
show std::string, but not in either form you showed), and the presence of the &
is important.

[Bug c++/52801] improve selective typedef unwrapping

2017-08-19 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52801

--- Comment #2 from Manuel López-Ibáñez  ---
(In reply to Eric Gallager from comment #1)
> Confirmed that the notes could ease up on the template spew; g++ output is
> now:

Note that I'm not complaining about the redundant notes listing the declaration
of the candidates (which are the subject of a different PR that I cannot find
right now). 

The object of improvement here is:

no known conversion from 'vector' to 'const std::basic_string'

versus

no known conversion for argument 1 from ‘std::vector’ to ‘const
std::__cxx11::basic_string&’

On the latter, gcc is excessively unwrapping typedef.

[Bug c++/52801] improve selective typedef unwrapping

2017-08-18 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52801

Eric Gallager  changed:

   What|Removed |Added

   Keywords||diagnostic, error-recovery
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-08-18
 CC||egallager at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Eric Gallager  ---
Confirmed that the notes could ease up on the template spew; g++ output is now:

$ /usr/local/bin/g++ -fsyntax-only 52801.cc
52801.cc: In function ‘void foo()’:
52801.cc:9:8: error: no match for ‘operator=’ (operand types are
‘std::__cxx11::string {aka std::__cxx11::basic_string}’ and
‘std::vector’)
  str = vec;
^~~
In file included from /usr/local/include/c++/8.0.0/string:52:0,
 from 52801.cc:2:
/usr/local/include/c++/8.0.0/bits/basic_string.h:627:7: note: candidate:
‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char;
_Traits = std::char_traits; _Alloc = std::allocator]’
   operator=(const basic_string& __str)
   ^~~~
/usr/local/include/c++/8.0.0/bits/basic_string.h:627:7: note:   no known
conversion for argument 1 from ‘std::vector’ to ‘const
std::__cxx11::basic_string&’
/usr/local/include/c++/8.0.0/bits/basic_string.h:666:7: note: candidate:
‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*)
[with _CharT = char; _Traits = std::char_traits; _Alloc =
std::allocator]’
   operator=(const _CharT* __s)
   ^~~~
/usr/local/include/c++/8.0.0/bits/basic_string.h:666:7: note:   no known
conversion for argument 1 from ‘std::vector’ to ‘const char*’
/usr/local/include/c++/8.0.0/bits/basic_string.h:677:7: note: candidate:
‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with
_CharT = char; _Traits = std::char_traits; _Alloc =
std::allocator]’
   operator=(_CharT __c)
   ^~~~
/usr/local/include/c++/8.0.0/bits/basic_string.h:677:7: note:   no known
conversion for argument 1 from ‘std::vector’ to ‘char’
/usr/local/include/c++/8.0.0/bits/basic_string.h:695:7: note: candidate:
‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with
_CharT = char; _Traits = std::char_traits; _Alloc =
std::allocator]’
   operator=(basic_string&& __str)
   ^~~~
/usr/local/include/c++/8.0.0/bits/basic_string.h:695:7: note:   no known
conversion for argument 1 from ‘std::vector’ to
‘std::__cxx11::basic_string&&’
/usr/local/include/c++/8.0.0/bits/basic_string.h:749:7: note: candidate:
‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits =
std::char_traits; _Alloc = std::allocator]’
   operator=(initializer_list<_CharT> __l)
   ^~~~
/usr/local/include/c++/8.0.0/bits/basic_string.h:749:7: note:   no known
conversion for argument 1 from ‘std::vector’ to
‘std::initializer_list’
$