8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-empty9.C
Jason Merrill 3f8e2835ae re PR c++/65896 (Erroneous uninitialized variable access error in constexpr function with temporary variables)
PR c++/65896
	* constexpr.c (cxx_eval_store_expression): Don't try to actually
	store an empty class.

From-SVN: r222549
2015-04-28 17:27:17 -04:00

19 lines
273 B
C

// PR c++/65896
// { dg-do compile { target c++11 } }
struct base {};
struct derived : base {
constexpr derived():
base{},
m_value(0) {
}
int m_value;
};
constexpr int by_ref(derived && value) {
return value.m_value;
}
constexpr int value = by_ref(derived{});