gcc/testsuite/g++.dg/cpp1y/paren1.C
raw| 1 | // PR c++/63437 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct X // movable but not copyable |
| 5 | { |
| 6 | X() = default; |
| 7 | X(X &&) = default; |
| 8 | |
| 9 | X(const X &) = delete; |
| 10 | }; |
| 11 | |
| 12 | X non_parenthesized() |
| 13 | { |
| 14 | X x; |
| 15 | return x; // works |
| 16 | } |
| 17 | |
| 18 | X parenthesized() |
| 19 | { |
| 20 | X x; |
| 21 | return (x); // error: use of deleted function 'X::X(const X&)' |
| 22 | } |
| 23 | |
| 24 | template <class T> |
| 25 | T parenthesized_t() |
| 26 | { |
| 27 | T t; |
| 28 | return (t); |
| 29 | } |
| 30 | |
| 31 | template X parenthesized_t<X>(); |