1 // PR c++/40306, c++/40307
2 // { dg-do run { target c++11 } }
3 
4 template< typename T >
5 struct test {
runtest6    test run() {
7       auto tmp = *this;
8       return tmp;
9    }
run_passtest10    test run_pass() {
11       test tmp( *this );
12       return tmp;
13    }
14 
run_failtest15    test run_fail() {
16       auto tmp( *this );
17       return tmp;
18    }
19 };
20 
main()21 int main()
22 {
23    test<int> x;
24    x.run();
25    x.run_pass();
26    x.run_fail();
27    return 0;
28 }
29