xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/debug-info-enum-class.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin -std=c++11 %s -o - | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc enum class A { A1=1 };                 // underlying type is int by default
4*f4a2713aSLionel Sambuc enum class B: unsigned long { B1=1 };  // underlying type is unsigned long
5*f4a2713aSLionel Sambuc enum C { C1 = 1 };
6*f4a2713aSLionel Sambuc enum D : short; // enum forward declaration
7*f4a2713aSLionel Sambuc A a;
8*f4a2713aSLionel Sambuc B b;
9*f4a2713aSLionel Sambuc C c;
10*f4a2713aSLionel Sambuc D d;
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc // CHECK: ; [ DW_TAG_enumeration_type ] [A] [line 3, size 32, align 32, offset 0] [def] [from int]
13*f4a2713aSLionel Sambuc // CHECK: ; [ DW_TAG_enumeration_type ] [B] [line 4, size 64, align 64, offset 0] [def] [from long unsigned int]
14*f4a2713aSLionel Sambuc // CHECK: ; [ DW_TAG_enumeration_type ] [C] [line 5, size 32, align 32, offset 0] [def] [from ]
15*f4a2713aSLionel Sambuc // CHECK: ; [ DW_TAG_enumeration_type ] [D] [line 6, size 16, align 16, offset 0] [decl] [from ]
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc namespace PR14029 {
18*f4a2713aSLionel Sambuc   // Make sure this doesn't crash/assert.
19*f4a2713aSLionel Sambuc   template <typename T> struct Test {
20*f4a2713aSLionel Sambuc     enum class Tag {
21*f4a2713aSLionel Sambuc       test = 0
22*f4a2713aSLionel Sambuc     };
23*f4a2713aSLionel Sambuc     Test() {
24*f4a2713aSLionel Sambuc       auto t = Tag::test;
25*f4a2713aSLionel Sambuc     }
26*f4a2713aSLionel Sambuc     Tag tag() const { return static_cast<Tag>(1); }
27*f4a2713aSLionel Sambuc   };
28*f4a2713aSLionel Sambuc   Test<int> t;
29*f4a2713aSLionel Sambuc }
30