2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wdangling-reference" }
4 // Like Wdangling-reference18.C but not actually a span-like class.
12 [[nodiscard]] constexpr auto operator[](int n) const noexcept -> T& { return data_[n]; }
13 [[nodiscard]] constexpr auto front() const noexcept -> T& { return data_[0]; }
14 [[nodiscard]] constexpr auto back() const noexcept -> T& { return data_[len_ - 1]; }
17 auto get() -> Span<int>;
20 int const& a = get().front(); // { dg-warning "dangling reference" }
21 int const& b = get().back(); // { dg-warning "dangling reference" }
22 int const& c = get()[0]; // { dg-warning "dangling reference" }