[LLVMbugs] [Bug 23657] New: no matching constructor for initialization of 'string' (aka 'basic_string<char>')

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 26 08:14:39 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23657

            Bug ID: 23657
           Summary: no matching constructor for initialization of 'string'
                    (aka 'basic_string<char>')
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: apyszczuk at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include <iostream>
#include <string>

using namespace std; 

class Foo { 
public:
    operator string() const { return n; }
    string n {"foo"};
};

int main (int argc, char** argv) {

    string s {Foo{}}; // Error
//    string s (Foo{}); // Ok

    cout << s << endl;

    return 0;
}

main.cpp:14:12: error: no matching constructor for initialization of 'string'
(aka 'basic_string<char>')
    string s {Foo{}}; // Error
           ^ ~~~~~~~

I asked about this on stackoverflow (link added below) and someone replied that
it possibly can be a clang bug, so I posted it here. Is this a bug? gcc 4.8.3
compiles it. 

http://stackoverflow.com/questions/30461583/no-matching-constructor-for-initialization-of-string-aka-basic-stringchar/30461995#30461995

Thanks

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150526/0a044f07/attachment.html>


More information about the llvm-bugs mailing list