https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71590

--- Comment #2 from gliu <markowitz73 at gmail dot com> ---
(In reply to Martin Sebor from comment #1)
> It is true that there is no std::string::operator=(int) but the assignment
> in 'x = a' resolves to std::string::operator(char).  The program is valid.

Thanks for explainatation. But I got confused because I got a compile error
when I try:
    int a = 1;
    std::string s = a;

error: invalid conversion from ‘int’ to ‘const char*’
error:   initializing argument 1 of ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char,
_Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’

Is that func treated as func<char> instead of func<int> ?

Reply via email to