blob: 8b23579217ec0b4b3fa2834079cfddc441690877 (
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
|
// { dg-options -std=c++0x }
template<typename T>
struct NonCopyable {
NonCopyable() = default;
NonCopyable(NonCopyable const&);
};
template<>
NonCopyable<int>::NonCopyable(NonCopyable<int> const&) = delete; // { dg-error "declared" }
template<typename T>
NonCopyable<T>::NonCopyable(NonCopyable<T> const&) = default;
template<>
NonCopyable<double>::NonCopyable(NonCopyable<double> const&) = delete; // { dg-error "declared" }
int main()
{
NonCopyable<double> nc_dbl;
NonCopyable<double> nc_dbl_cpy(nc_dbl); // { dg-error "use" }
NonCopyable<int> nc_int;
NonCopyable<int> nc_int_cpy(nc_int); // { dg-error "use" }
NonCopyable<char> nc_char;
NonCopyable<char> nc_char_cpy(nc_char);
}
|