brintos

brintos / llvm-project-archived public Read only

0
0
Text · 871 B · ace979c Raw
45 lines · plain
1// RUN: llvm-tblgen --no-warn-on-unused-template-args %s | FileCheck %s2// XFAIL: vg_leak3 4class A<int k, bits<2> x = 1> {5  int K = k;6  bits<2> Bits = x;7}8 9// CHECK: def a110// CHECK: Bits = { 0, 1 }11def a1 : A<12>;12 13// CHECK: def a214// CHECK: Bits = { 1, 0 }15def a2 : A<13, 2>;16 17// Here was the bug: X.Bits would get resolved to the default a1.Bits while18// resolving the first template argument. When the second template argument19// was processed, X would be set correctly, but Bits retained the default20// value.21class B<int k, A x = a1> {22  A X = x;23  bits<2> Bits = X.Bits;24}25 26// CHECK: def b127// CHECK: Bits = { 0, 1 }28def b1 : B<27>;29 30// CHECK: def b231// CHECK: Bits = { 1, 0 }32def b2 : B<28, a2>;33 34class C<A x = a1> {35  bits<2> Bits = x.Bits;36}37 38// CHECK: def c139// CHECK: Bits = { 0, 1 }40def c1 : C;41 42// CHECK: def c243// CHECK: Bits = { 1, 0 }44def c2 : C<a2>;45