diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp1z/decomp42.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/decomp42.C | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp42.C b/gcc/testsuite/g++.dg/cpp1z/decomp42.C new file mode 100644 index 00000000000..22c68ebd3a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/decomp42.C @@ -0,0 +1,18 @@ +// PR c++/85210 +// { dg-do compile { target c++11 } } +// { dg-options "" } + +struct A { int i; }; + +template <int> +void +foo (int j) +{ + auto [j] = A{j}; // { dg-error "shadows a parameter" } +} // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 } + +void +bar () +{ + foo<0> (0); +} |