view gcc/testsuite/g++.dg/tc1/dr152.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { 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-message "initializing" }
  int foo() 
  { 
    X x; 
    f(x);     // { dg-error "matching" "matching" }
    return 0;
  }
}

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

  template <class T>
  void f(T) {}			// { dg-message "initializing" }
  
  template <class T>
  int foo() 
  { 
    X<T> x; 
    N2::f(x);   // { dg-error "matching" "matching" }
    return 0;
  }

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