1// Origin: PR c++/47398
2// { dg-do compile }
3
4template<int>
5struct A
6{
7  typedef int INT;
8};
9
10template<int I>
11struct transform
12{
13  static int bar();
14};
15
16template<class T, int a, class U, int b>
17struct B
18{
19  typedef typename A<a>::INT TINT;
20  void baz();
21};
22
23template<class T, int a, class U>
24struct B<T, a, U, 1>
25{
26  typedef typename A<a>::INT TINT;
27  void foo();
28};
29
30template<class T, int a, class U, int b>
31void
32B<T, a, U, b>::baz()
33{
34  int c = transform<sizeof(TINT)>::bar();//#0
35}
36
37template<class T, int a, class U>
38void
39B<T, a, U, 1>::foo()
40{
41  int c = transform<sizeof(TINT)>::bar();//#1
42}
43
44int
45main()
46{
47  B<int, 2, char, 1> i;
48  i.foo();
49  // While instantiating
50  //
51  //   template<class T, int a, class U> void B<T, a, U, 1>::foo()
52  //
53  // lookup_template_class resolves transform<sizeof(TINT)> in #1 to
54  // the wrong one; it picks up the one in #0 instead. This is because
55  // to compare the two A<a> comp_template_args uses cp_tree_equal
56  // that fails to consider the number of siblings of parm 'a'.
57return 0;
58}
59