[cfe-commits] r172375 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Parser/cxx0x-decl.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Sun Jan 13 17:55:13 PST 2013
Author: rsmith
Date: Sun Jan 13 19:55:13 2013
New Revision: 172375
URL: http://llvm.org/viewvc/llvm-project?rev=172375&view=rev
Log:
*this is const in a trailing-return-type for a constexpr member function.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Parser/cxx0x-decl.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=172375&r1=172374&r2=172375&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sun Jan 13 19:55:13 2013
@@ -4761,7 +4761,9 @@
Actions.CurContext->isRecord()));
Sema::CXXThisScopeRAII ThisScope(Actions,
dyn_cast<CXXRecordDecl>(Actions.CurContext),
- DS.getTypeQualifiers(),
+ DS.getTypeQualifiers() |
+ (D.getDeclSpec().isConstexprSpecified()
+ ? Qualifiers::Const : 0),
IsCXX11MemberFunction);
// Parse exception-specification[opt].
Modified: cfe/trunk/test/Parser/cxx0x-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-decl.cpp?rev=172375&r1=172374&r2=172375&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-decl.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-decl.cpp Sun Jan 13 19:55:13 2013
@@ -41,3 +41,11 @@
};
using PR14855 = int S::; // expected-error {{expected ';' after alias declaration}}
+
+// Ensure that 'this' has a const-qualified type in a trailing return type for
+// a constexpr function.
+struct ConstexprTrailingReturn {
+ int n;
+ constexpr auto f() -> decltype((n));
+};
+constexpr const int &ConstexprTrailingReturn::f() const { return n; }
More information about the cfe-commits
mailing list