8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-sizeof2.C
Marek Polacek 99e764a225 PR c++/90825 - endless recursion when evaluating sizeof.
PR c++/90832 - endless recursion when evaluating sizeof.
	* constexpr.c (cxx_eval_constant_expression): Don't recurse on the
	result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
	* typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
	is instantiation-dependent.

	* g++.dg/cpp0x/constexpr-sizeof2.C: New test.
	* g++.dg/cpp0x/constexpr-sizeof3.C: New test.

From-SVN: r272221
2019-06-12 22:26:54 +00:00

15 lines
300 B
C

// PR c++/90825 - endless recursion when evaluating sizeof.
// { dg-do compile { target c++11 } }
class address {
char host_[63];
public:
static constexpr unsigned buffer_size() noexcept { return sizeof(host_); }
};
template <class Archive>
void load()
{
char host[address::buffer_size()];
}