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

            Bug ID: 31577
           Summary: Spurious "conditional expression is ambiguous; 'S' and
                    'const char [1]' can be converted to several common
                    types"
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

//////////// test.cpp ////////////
struct S
{
    operator char*() const;
};

void fun()
{
    S s;
    const char* p = true ? s : "";
}
//////////////////////////////////

$ clang test.cpp
test.cpp:9:23: error: conditional expression is ambiguous; 'S' and 'const char
[1]' can be converted to several common types
        const char* p = true ? s : "";
                             ^ ~   ~~
1 error generated.

Doesn't occur with gcc or msvc.

Additionally, would be nice if it listed what the several common types are.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to