1 // PR c++/54777 2 // { dg-options -std=c++0x } 3 4 struct S 5 { 6 int s[1]; fooS7 constexpr const int &foo (unsigned i) { return (i < 1 ? 0 : throw 1), s[i]; } barS8 constexpr const int &bar (unsigned i) { return i < 1 ? s[i] : (throw 0, s[i]); } 9 }; 10 11 int main()12main () 13 { 14 constexpr S a {}; 15 constexpr int i = a.foo (0); 16 constexpr int j = a.bar (0); 17 static_assert (i == j, "Ouch"); 18 } 19