[llvm-bugs] [Bug 31577] New: Spurious "conditional expression is ambiguous; 'S' and 'const char [1]' can be converted to several common types"

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 7 21:48:34 PST 2017


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: unassignedclangbugs at nondot.org
          Reporter: llvm at thecybershadow.net
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170108/c7e98c90/attachment.html>


More information about the llvm-bugs mailing list