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

            Bug ID: 21086
           Summary: Attempting to convert implicitly with explicit
                    conversion operator generates an odd error
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

When I attempiting to convert the value which is explicitly convertible to
bool, an odd error occurs.
Below is a code to reproduce it.


class X {
    explicit operator bool()
    {
        return false;
    }
};

int main()
{
    bool b = {X{}};
    return 0;
}


When the code is compiled, below error will be shown.


hoge.cpp:12:10: error: no viable conversion from 'void' to 'bool'
    bool b = {X{}};
         ^   ~~~~~
1 error generated.


where does 'void' come from?  I think this error message is incorrect.

I could reproduce this bug with clang 3.4.2 in OS X, clang 3.5.0 in Linux and
clang 3.6.0 (trunk 218519) .
Below link is the output of clang 3.6.0 by online compiler.

http://melpon.org/wandbox/permlink/1n5XjHmXVIxi3CCW

-- 
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