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

            Bug ID: 18240
           Summary: С++11 standard compliance parts 12.3.2.2 and 8.5.15
           Product: new-bugs
           Version: 3.3
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

For the code

struct A
{
      explicit operator bool() { return true; }
};


int main()
{
        A a;
    bool b { a };  // BUG or Error here??
}

I have error:
error: no viable conversion from 'A' to 'bool'

but part 12.3.2.2 of the C++11 standard states that "explicit operator bool()"
will be (and must be) used in the direct initialization, and according to the
part 8.5.15 of the C++11 standard "bool b{a}" is a direct initialization of the
b. So is it a bug or I miss something?

GCC 4.8.2 accept such code without error.

I use clang++ under Mac OS X (clang++ --version says: Apple LLVM version 5.0
(clang-500.2.79) (based on LLVM 3.3svn))

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to