diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-23 21:53:47 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-23 21:53:47 +0000 |
commit | 88623ade9599d2a2f4e21e80bce00fb4cb9e7d5f (patch) | |
tree | 535c35b3d17013f27123441422ccc78f074c4962 /test/SemaCXX/enum.cpp | |
parent | 26d1f75d5b8a1a7dee8d844a0cb38a1676c84842 (diff) |
In C++, one cannot assign from an arithmetic type to an enumeration
type. Fixes PR7051.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104475 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/enum.cpp')
-rw-r--r-- | test/SemaCXX/enum.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/SemaCXX/enum.cpp b/test/SemaCXX/enum.cpp index dc4a506dda..bfb5784dd1 100644 --- a/test/SemaCXX/enum.cpp +++ b/test/SemaCXX/enum.cpp @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++98 -verify -triple x86_64-apple-darwin %s - enum E { Val1, Val2 @@ -71,3 +70,12 @@ namespace PR6061 { namespace Conditional { enum a { A }; a x(const enum a x) { return 1?x:A; } } + +namespace PR7051 { + enum E { e0 }; + void f() { + E e; + e = 1; // expected-error{{assigning to 'PR7051::E' from incompatible type 'int'}} + e |= 1; // expected-error{{assigning to 'PR7051::E' from incompatible type 'int'}} + } +} |