[LLVMbugs] [Bug 6757] New: ternary operator: incompatible operand types ('Foo const' and 'Foo')

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 1 10:54:54 PDT 2010


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

           Summary: ternary operator: incompatible operand types ('Foo
                    const' and 'Foo')
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: evan at chromium.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=4621)
 --> (http://llvm.org/bugs/attachment.cgi?id=4621)
test case as found in bug

This came up in WebCore.
Simplified test case follows, will also attach.

I believe this may have worked in the past, which would make this a regression.
 But it's also possible the code in WebCore changed since the last time I
compiled this area.


build with 
clang++ -c test.cc
test.cc:12:16: error: incompatible operand types ('Foo const' and 'Foo')
  Foo x = true ? Bar() : Foo();
               ^ ~~~~~   ~~~~~


struct Foo {
};

struct Bar {
  operator const Foo&() const;
};

void f() {
  Foo x = true ? Bar() : Foo();
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list