public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55437] New: Non-const copy constructor causes error - even if not called
@ 2012-11-22  5:17 rockydowns0485 at msn dot com
  2012-11-22 12:48 ` [Bug c++/55437] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: rockydowns0485 at msn dot com @ 2012-11-22  5:17 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55437
           Summary: Non-const copy constructor causes error - even if not
                    called
    Classification: Unclassified
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rockydowns0485@msn.com


I believe the error below should not occur.  The copy constructor in question
is not exercised.  Moreover, making the copy constructor const also makes the
error not occur.



class String{
public:
    String(String& s){} // No error if this line is removed
    String(const char* s){}
};

int main(){
    String S = (char*)"Test";
    return 0;
}


test2.cpp: In function ‘int main()’:
test2.cpp:9: error: no matching function for call to ‘String::String(String)’
test2.cpp:5: note: candidates are: String::String(const char*)
test2.cpp:4: note:                 String::String(String&)


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

end of thread, other threads:[~2012-11-22 12:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22  5:17 [Bug c++/55437] New: Non-const copy constructor causes error - even if not called rockydowns0485 at msn dot com
2012-11-22 12:48 ` [Bug c++/55437] " redi at gcc dot gnu.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).