1 // { dg-options -std=c++0x } 2 3 template<typename T> 4 struct NonCopyable { 5 NonCopyable() = default; 6 NonCopyable(NonCopyable const&); 7 }; 8 9 template<> 10 NonCopyable<int>::NonCopyable(NonCopyable<int> const&) = delete; // { dg-error "declared" } 11 12 template<typename T> 13 NonCopyable<T>::NonCopyable(NonCopyable<T> const&) = default; 14 15 template<> 16 NonCopyable<double>::NonCopyable(NonCopyable<double> const&) = delete; // { dg-error "declared" } 17 18 main()19int main() 20 { 21 NonCopyable<double> nc_dbl; 22 NonCopyable<double> nc_dbl_cpy(nc_dbl); // { dg-error "use" } 23 24 NonCopyable<int> nc_int; 25 NonCopyable<int> nc_int_cpy(nc_int); // { dg-error "use" } 26 27 NonCopyable<char> nc_char; 28 NonCopyable<char> nc_char_cpy(nc_char); 29 } 30