Debian Codegraph @

gcc/testsuite/g++.dg/init/reference3.C

raw
1 // { dg-do compile }
2 // { dg-additional-options "-Wno-return-type" }
3 // This code used to be accepted but it is invalid as there is no
4 // value initialization of a reference type.
5 // PR c++/36695
6
7 template <typename T>
8 T f()
9 {
10 T a = T(); // { dg-error "value-initialization of reference" }
11 }
12
13 int &a = f<int&>(); // { dg-message "required from here" }
14