[LLVMbugs] [Bug 15626] New: gnu extension "?:" with enums not faithful

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 29 05:34:12 PDT 2013


            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: unassignedclangbugs at nondot.org
          Reporter: ggreif at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130329/fe75abf4/attachment.html>

More information about the llvm-bugs mailing list