[llvm-bugs] [Bug 31229] New: ambiguous operator<< for c++11 enum of type bool

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 1 13:46:54 PST 2016


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

            Bug ID: 31229
           Summary: ambiguous operator<< for c++11 enum of type bool
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vik.kirilov at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following code does not compile with any clang version I have tested:

#include <iostream>

enum A : bool {
    Yup = true,
    Nop = false,
};

int main() { 
    A t = Yup;
    std::cout << t;
}

This is the error:

error: use of overloaded operator '<<' is ambiguous (with operand types
'ostream' (aka 'basic_ostream<char>') and 'A')

Here is a link to an online compiler:
http://melpon.org/wandbox/permlink/YtTxiYfVsmJR16Ih

This issue is non-existent with gcc.

Hope this is not a duplicate... first bug report here.

-- 
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/20161201/b5c5be8d/attachment.html>


More information about the llvm-bugs mailing list