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++/29824] New: std::string() causes assignment errors


#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


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