blob: 07b3a69e46b2676a1fb51025d06a5eb037a3577e [file] [log] [blame]
// PR c++/102482
// { dg-do compile { target c++11 } }
// Test we don't warn for non-const lvalue refs.
#include <initializer_list>
struct X { };
struct span
{
span(std::initializer_list<int>& il)
: begin(il.begin()) // { dg-bogus "initializer_list" }
{ }
const int* begin;
};
struct span_warn
{
span_warn(std::initializer_list<int> il)
: begin(il.begin()) // { dg-warning "initializer_list" }
{ }
const int* begin;
};
struct span_warn2
{
span_warn2(std::initializer_list<int>&& il)
: begin(il.begin()) // { dg-warning "initializer_list" }
{ }
const int* begin;
};
struct span_warn3
{
span_warn3(std::initializer_list<int> const& il)
: begin(il.begin()) // { dg-warning "initializer_list" }
{ }
const int* begin;
};
struct span_warn4
{
span_warn4(std::initializer_list<int> const il)
: begin(il.begin()) // { dg-warning "initializer_list" }
{ }
const int* begin;
};
struct span_warn5
{
span_warn5(std::initializer_list<int> const&& il)
: begin(il.begin()) // { dg-warning "initializer_list" }
{ }
const int* begin;
};