summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.pt/spec36.C
blob: e52323b6bb4f5708923231ed6729f3f1ea872a37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// { dg-do run  }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 Jan 2001 <nathan@codesourcery.com>

// Bug 1617. We didn't resolve partial ordering properly. The std is rather
// vague about it anyway, DR 214 talks about this.

extern "C" int puts (char const *);

template <typename T> int Foo (T *) {puts (__PRETTY_FUNCTION__); return 1;}
template <typename T> int Foo (T &) {puts (__PRETTY_FUNCTION__); return 2;}
template <typename T> int Foo (T const &) {puts (__PRETTY_FUNCTION__); return 3;}

template <typename T> int Bar (T const *const &) {puts (__PRETTY_FUNCTION__); return 4;}
template <typename T> int Bar (T *const &) {puts (__PRETTY_FUNCTION__); return 5;}
template <typename T> int Bar (T *) {puts (__PRETTY_FUNCTION__); return 6;}

template <typename T> int Quux (T *const &) {puts (__PRETTY_FUNCTION__); return 7;}
template <typename T> int Quux (T const &) {puts (__PRETTY_FUNCTION__); return 8;}


int Baz (int const *ptr, int *ptr2)
{
  if (Foo (ptr) != 1)
    return 1;
  if (Foo (ptr2) != 1)
    return 2;
  if (Foo (*ptr) != 3)
    return 3;
  if (Foo (*ptr2) != 2)
    return 4;
  
  if (Bar (ptr) != 4)
    return 5;
  
  if (Quux (ptr) != 7)
    return 5;
  if (Quux (ptr2) != 7)
    return 6;
  
  return 0;
}

int main ()
{
  return Baz (0, 0);
}