aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tc1/dr152.C
blob: bf742ee9b8ae56e7be98efb26030dc2abbe69de4 (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
// { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR152: explicit copy constructors 

namespace N1 {
  struct X {
    X();			// { dg-message "note" }
    explicit X(const X&);
  };
  void f(X);			// { dg-error "initializing" }
  int foo() 
  { 
    X x; 
    f(x);     // { dg-error "matching" "matching" }
    // { dg-message "candidate" "candidate note" { target *-*-* } 14 }
  }
}

namespace N2 {
  template <class T>
  struct X {
    X();			// { dg-message "note" }
    explicit X(const X&);
  };

  template <class T>
  void f(T ) {}			// { dg-error "initializing" }
  
  template <class T>
  int foo() 
  { 
    X<T> x; 
    N2::f(x);   // { dg-error "matching" "matching" }
    // { dg-message "candidate" "candidate note" { target *-*-* } 33 }
  }

  template int foo<float>();  // { dg-message "required from here" }
}