<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - enum types defined by CF_ENUM cannot be used as numeric values in C++11"
href="https://llvm.org/bugs/show_bug.cgi?id=24948">24948</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>enum types defined by CF_ENUM cannot be used as numeric values in C++11
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>191919@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The following code (assuming it is saved as `1.mm`)
```
#import <Foundation/Foundation.h>
typedef CF_ENUM(uint64_t, MyEnum) {
kFirstBit = 0,
kSecondBit = 1,
kThirdBit = 2
};
int main() {
MyEnum e = kFirstBit | kSecondBit;
}
```
was compilable by clang 3.6 but cannot in clang 3.7/3.8svn with C++11 mode.
$ clang++ -o 1.o 1.mm # succeeded
$ clang++ -std=c++11 -o 1.o 1.mm
1.mm:11:9: error: cannot initialize a variable of type 'MyEnum' with an rvalue
of type 'unsigned long long'
MyEnum e = kFirstBit | kSecondBit;
^ ~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
MyEnum was regarded as strong enum by -std=c++11.
This change of behavior makes a lot of codes cannot be compiled as
Objective-C++ in C++11 mode.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>