constexpr const int MaybeReturnNonstaticRef(bool b, const int a) { // expected-note {{here}} // If ObscureTheTruth returns a reference to 'a', the result is not a // constant expression even though 'a' is still in scope. return ObscureTheTruth(b ? a : k); // expected-note {{in call to 'ObscureTheTruth(a)'}} }
constexpr const int &MaybeReturnJunk(bool b, const int a) { // expected-note 2{{declared here}} return ObscureTheTruth(b ? a : k); // expected-note 2{{in call to 'ObscureTheTruth(a)'}} }
constexpr const int MaybeReturnNonstaticRef(bool b, const int a) { // If ObscureTheTruth returns a reference to 'a', the result is not a // constant expression even though 'a' is still in scope. return ObscureTheTruth(b ? a : k); }
constexpr const int MaybeReturnNonstaticRef(bool b, const int a) { return ObscureTheTruth(b ? a : k); }
constexpr const int &MaybeReturnJunk(bool b, const int a) { return ObscureTheTruth(b ? a : k); }