[Bug c++/29824] New: std::string() causes assignment errors

diltsman at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 14 05:17:00 GMT 2006


#include <string>

int main()
{
    std::string a();
    a="alskdfjasdj";
    return 0;
}

output:
test.cpp: In function int main():
test.cpp:6: error: assignment of function std::string a()
test.cpp:6: error: cannot convert const char [12] to std::string ()() in
assignment

#include <string>

int main()
{
    std::string a("");
    a="alskdfjasdj";
    return 0;
}

This compiles.

My understanding is that std::string a() and std::string a("") should have
exactly the same result, such that the assignment of the c-string should be
valid in both situations.


-- 
           Summary: std::string() causes assignment errors
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: diltsman at gmail dot com


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



More information about the Gcc-bugs mailing list