blob: fd243abb2e84ba3bc562911abc76a924000f6516 [file] [log] [blame]
Eric Christopher9ee5f462012-05-23 00:09:47 +00001// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin -std=c++11 %s -o - | FileCheck %s
2
3enum class A { A1=1 }; // underlying type is int by default
4enum class B: unsigned long { B1=1 }; // underlying type is unsigned long
5enum C { C1 = 1 };
Eric Christopher5a2eff82012-06-01 00:22:57 +00006enum D : short; // enum forward declaration
Eric Christopher9ee5f462012-05-23 00:09:47 +00007A a;
8B b;
9C c;
Eric Christopher5a2eff82012-06-01 00:22:57 +000010D d;
Eric Christopher9ee5f462012-05-23 00:09:47 +000011
12// CHECK: metadata !{i32 {{.*}}, null, metadata !"A", metadata !4, i32 3, i64 32, i64 32, i32 0, i32 0, metadata !5, metadata !6, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
13// CHECK: metadata !{i32 {{.*}}, null, metadata !"B", metadata !4, i32 4, i64 64, i64 64, i32 0, i32 0, metadata !9, metadata !10, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
14// CHECK: metadata !{i32 {{.*}}, null, metadata !"C", metadata !4, i32 5, i64 32, i64 32, i32 0, i32 0, null, metadata !13, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
Eli Friedmane6b39bc2012-10-05 01:49:33 +000015// CHECK: metadata !{i32 {{.*}}, null, metadata !"D", metadata !4, i32 6, i64 16, i64 16, i32 0, i32 4, null, null, i32 0} ; [ DW_TAG_enumeration_type ]
16
17namespace 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}