[llvm-bugs] [Bug 27098] New: [ms] enums are always ints but should not appear to have a fixed underlying type

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 28 13:12:07 PDT 2016


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

            Bug ID: 27098
           Summary: [ms] enums are always ints but should not appear to
                    have a fixed underlying type
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: david.majnemer at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk
    Classification: Unclassified

Consider:
$ cat t.cpp
enum A {};
void f() { A{0}; }

$ clang -cc1 t.cpp -std=c++1z -triple x86_64-linux
t.cpp:2:18: error: cannot initialize a value of type 'A' with an rvalue of type
'int'
A f() { return A{0}; }
                 ^
1 error generated.

$ clang -cc1 t.cpp -std=c++1z -triple x86_64-windows-msvc
# no output


We always give MS enums the underlying type 'int'. In the AST,
EnumDecl::isFixed returns true, even when the user did not write ': int'. We
should arrange to make that return false while still using an 'int'
representation by default.

-- 
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/20160328/7ba02c06/attachment.html>


More information about the llvm-bugs mailing list