Eric Christopher | 9ee5f46 | 2012-05-23 00:09:47 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin -std=c++11 %s -o - | FileCheck %s |
| 2 | |
| 3 | enum class A { A1=1 }; // underlying type is int by default |
| 4 | enum class B: unsigned long { B1=1 }; // underlying type is unsigned long |
| 5 | enum C { C1 = 1 }; |
Eric Christopher | 5a2eff8 | 2012-06-01 00:22:57 +0000 | [diff] [blame] | 6 | enum D : short; // enum forward declaration |
Eric Christopher | 9ee5f46 | 2012-05-23 00:09:47 +0000 | [diff] [blame] | 7 | A a; |
| 8 | B b; |
| 9 | C c; |
Eric Christopher | 5a2eff8 | 2012-06-01 00:22:57 +0000 | [diff] [blame] | 10 | D d; |
Eric Christopher | 9ee5f46 | 2012-05-23 00:09:47 +0000 | [diff] [blame] | 11 | |
David Blaikie | 09a5604 | 2013-06-21 03:41:46 +0000 | [diff] [blame^] | 12 | // CHECK: ; [ DW_TAG_enumeration_type ] [A] [line 3, size 32, align 32, offset 0] [def] [from int] |
| 13 | // CHECK: ; [ DW_TAG_enumeration_type ] [B] [line 4, size 64, align 64, offset 0] [def] [from long unsigned int] |
| 14 | // CHECK: ; [ DW_TAG_enumeration_type ] [C] [line 5, size 32, align 32, offset 0] [def] [from ] |
| 15 | // CHECK: ; [ DW_TAG_enumeration_type ] [D] [line 6, size 16, align 16, offset 0] [decl] [from ] |
Eli Friedman | e6b39bc | 2012-10-05 01:49:33 +0000 | [diff] [blame] | 16 | |
| 17 | namespace PR14029 { |
| 18 | // Make sure this doesn't crash/assert. |
| 19 | template <typename T> struct Test { |
| 20 | enum class Tag { |
| 21 | test = 0 |
| 22 | }; |
| 23 | Test() { |
| 24 | auto t = Tag::test; |
| 25 | } |
| 26 | Tag tag() const { return static_cast<Tag>(1); } |
| 27 | }; |
| 28 | Test<int> t; |
| 29 | } |