public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29824]  New: std::string() causes assignment errors
@ 2006-11-14  5:17 diltsman at gmail dot com
  2006-11-14  5:19 ` [Bug c++/29824] " diltsman at gmail dot com
  2006-11-14  5:21 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: diltsman at gmail dot com @ 2006-11-14  5:17 UTC (permalink / raw)
  To: gcc-bugs

#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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/29824] std::string() causes assignment errors
  2006-11-14  5:17 [Bug c++/29824] New: std::string() causes assignment errors diltsman at gmail dot com
@ 2006-11-14  5:19 ` diltsman at gmail dot com
  2006-11-14  5:21 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: diltsman at gmail dot com @ 2006-11-14  5:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from diltsman at gmail dot com  2006-11-14 05:18 -------
I neglected to comment that the command line was:
g++ test.cpp


-- 


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/29824] std::string() causes assignment errors
  2006-11-14  5:17 [Bug c++/29824] New: std::string() causes assignment errors diltsman at gmail dot com
  2006-11-14  5:19 ` [Bug c++/29824] " diltsman at gmail dot com
@ 2006-11-14  5:21 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-14  5:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-11-14 05:21 -------
    std::string a();

This declares a function that returns std::string.

This is what the C++ standard says how to resolve this ambigous statement.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-14  5:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-14  5:17 [Bug c++/29824] New: std::string() causes assignment errors diltsman at gmail dot com
2006-11-14  5:19 ` [Bug c++/29824] " diltsman at gmail dot com
2006-11-14  5:21 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).