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

            Bug ID: 15626
           Summary: gnu extension "?:" with enums not faithful
           Product: clang
           Version: 3.2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

$ clang gnutest.cc
gnutest.cc:7:10: error: cannot initialize return object of type 'Howdy' with an
rvalue of type 'int'
  return you ?: Hi;
         ^~~~~~~~~
1 error generated.

This works nicely with g++ (v3.4 and v4.4). I guess clang models this as

 >   int temp = you;
 >   return temp ? temp : Hi;

while g++ does:

 >   Howdy temp = you;
 >   return temp ? temp : Hi;


The test program is:

$ cat gnutest.cc 
enum Howdy {
  Lo, Hi 
};

Howdy test(Howdy you)
{
  return you ?: Hi;
}

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