This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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: unassigned@gcc.gnu.org
        ReportedBy: manu@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]