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: unassig...@gcc.gnu.org
        ReportedBy: rockydowns0...@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&)

Reply via email to