3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 24 Jun 2004 <nathan@codesourcery.com>
6 // Origin Rani Sharoni via giovannibajo@libero.it
7 // Bug 16174, SFINAE failure.
9 template <class T> struct K
15 template <class U> K(K<U> const& rhs);
18 template <class U> struct A;
19 template <class U> struct A< K<U> const>
20 { typedef typename K<U>::compile_time_error type; };
22 // This is used to reject calls to the copy constructor
23 // with objects which are top-level const. If they are
24 // const, the specialization of A is instantiated and
25 // causes a compile time error. Otherwise, the general
26 // template is picked up, it misses definition, so this
27 // ctor declaration is rejected by SFINAE and everybody
29 // GCC 3.4.1pre and 3.5.0 always matches A's specialization
30 // when instantiating from foo(), and this causes the error.
32 K(U& rhs, typename A<U>::type = 0);