xref: /llvm-project/clang/test/CXX/temp/temp.param/p5.cpp (revision afe48f9d68e446829bed6ce72b319c915873809a)
1d6a15082SRichard Smith // RUN: %clang_cc1 -verify %s -std=c++14
2d0e1c95dSRichard Smith 
3*afe48f9dSRichard Smith template<const int I> struct S { // expected-error {{reference member 'r' binds to a temporary object}}
4d0e1c95dSRichard Smith   decltype(I) n;
5*afe48f9dSRichard Smith   int &&r = I; // expected-note {{default member initializer}}
6d0e1c95dSRichard Smith };
7d87aab93SRichard Smith S<5> s; // expected-note {{implicit default constructor}}
8d0e1c95dSRichard Smith 
9*afe48f9dSRichard Smith template<typename T, T v> struct U { // expected-error {{reference member 'r' binds to a temporary object}}
10d0e1c95dSRichard Smith   decltype(v) n;
11*afe48f9dSRichard Smith   int &&r = v; // expected-note {{default member initializer}}
12d0e1c95dSRichard Smith };
13d87aab93SRichard Smith U<const int, 6> u; // expected-note {{implicit default constructor}}
14