Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp0x/auto22.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 // PR c++/47999 |
2 // { dg-do compile { target c++11 } } | |
3 | |
4 int& identity(int& i) | |
5 { | |
6 return i; | |
7 } | |
8 | |
9 // In a function template, auto type deduction works incorrectly. | |
10 template <typename = void> | |
11 void f() | |
12 { | |
13 int i = 0; | |
14 auto&& x = identity(i); // Type of x should be `int&`, but it is `int&&`. | |
15 } | |
16 | |
17 int main (int argc, char* argv[]) | |
18 { | |
19 f(); | |
20 return 0; | |
21 } |