[LLVMbugs] [Bug 17376] New: initialization list with conversion operator dont work properly and report error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 25 23:49:37 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17376

            Bug ID: 17376
           Summary: initialization list with conversion operator dont work
                    properly and report error
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mayur.p at samsung.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    mayurthebond at gmail.com
    Classification: Unclassified

for the following code:

struct X
{
  X();
};

struct Y
{
  operator X() const;
};

X a = { Y() };    // reports error: no matching constructor for initialization
of 'X'
X aa = Y();  // works fine


clang when compiled with std=c++11 gives compilation errors as:


testfile.C:11:3: error: no matching constructor for initialization of 'X'
X a = { Y() };    // reports error: no matching constructor for initialization
of 'X'
  ^   ~~~~~~~
testfile.C:1:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'Y' to 'const X &' for 1st
      argument
struct X
       ^
testfile.C:1:8: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from 'Y' to 'X &&' for 1st
      argument
struct X
       ^
testfile.C:3:3: note: candidate constructor not viable: requires 0 arguments,
but 1 was provided
  X();
  ^
1 error generated.

It should have not thrown error as it works fine with gcc.

-- 
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/20130926/5a462839/attachment.html>


More information about the llvm-bugs mailing list