On Tue, November 1, 2011 17:41, Matthieu Monrocq wrote: [...] >> Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expressi >> on-cxx11.cpp?rev=143463&r1=143462&r2=143463&view=diff >> >> =========================================================================== >> === >> --- cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp (original) >> +++ cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp Tue Nov 1 >> 11:57:24 2011 >> @@ -102,6 +102,14 @@ >> constexpr int n1 = MaybeReturnJunk(false, 0); // ok constexpr int n2 = >> MaybeReturnJunk(true, 0); // expected-error {{must be >> initialized by a constant expression}} >> >> + 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 int n1a = MaybeReturnJunk(false, 0); // ok >> + constexpr int n2a = MaybeReturnJunk(true, 0); // expected-error {{must >> be initialized by a constant expression}} + > > Is it your intention to use MaybeReturnJunk and not the newly introduced > MaybeReturnNonstaticRef here ?
No, it wasn't. Thanks! Fixed in r143505. Richard _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
