http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52801
Bug #: 52801 Summary: improve selective typedef unwrapping Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: m...@gcc.gnu.org #include <vector> #include <string> using namespace std; typedef double Real; string str; vector<Real> vec; void foo(void) { str = vec; } manuel@gcc12:~$ ~/bin/clang -fsyntax-only ~/g2.cpp /home/manuel/g2.cpp:9:7: error: no viable overloaded '=' str = vec; ~~~ ^ ~~~ /usr/include/c++/4.3/bits/basic_string.h:500:7: note: candidate function not viable: no known conversion from 'vector<Real>' to 'const std::basic_string<char>' for 1st argument; operator=(const basic_string& __str) ^ /usr/include/c++/4.3/bits/basic_string.h:508:7: note: candidate function not viable: no known conversion from 'vector<Real>' to 'const char *' for 1st argument; operator=(const _CharT* __s) ^ /usr/include/c++/4.3/bits/basic_string.h:519:7: note: candidate function not viable: no known conversion from 'vector<Real>' to 'char' for 1st argument; operator=(_CharT __c) ^ 1 error generated. /home/manuel/g2.cpp: In function ‘void foo()’: /home/manuel/g2.cpp:9:9: error: no match for ‘operator=’ in ‘str = vec’ /home/manuel/g2.cpp:9:9: note: candidates are: In file included from /home/manuel/trunk/180166/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/string:54:0, from /home/manuel/g2.cpp:2: /home/manuel/trunk/180166/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/basic_string.h:541:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string<char>] /home/manuel/trunk/180166/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/basic_string.h:541:7: note: no known conversion for argument 1 from ‘std::vector<double>’ to ‘const std::basic_string<char>&’ /home/manuel/trunk/180166/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/basic_string.h:549:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string<char>] /home/manuel/trunk/180166/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/basic_string.h:549:7: note: no known conversion for argument 1 from ‘std::vector<double>’ to ‘const char*’ /home/manuel/trunk/180166/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/basic_string.h:560:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string<char>] /home/manuel/trunk/180166/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/basic_string.h:560:7: note: no known conversion for argument 1 from ‘std::vector<double>’ to ‘char’ Example #4 of Typedef Preservation and Selective Unwrapping http://clang.llvm.org/diagnostics.html