diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-14 01:55:13 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-14 01:55:13 +0000 |
| commit | 01141a95a5bf42be3d284e55dac9090d19be91d0 (patch) | |
| tree | c8fd539aadfb01c1fb50a0303fddfc65706865c3 | |
| parent | 4385edf5cb65688c0f3491b5fd8eb321efc469f3 (diff) | |
| download | bcm5719-llvm-01141a95a5bf42be3d284e55dac9090d19be91d0.tar.gz bcm5719-llvm-01141a95a5bf42be3d284e55dac9090d19be91d0.zip | |
*this is const in a trailing-return-type for a constexpr member function.
llvm-svn: 172375
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 4 | ||||
| -rw-r--r-- | clang/test/Parser/cxx0x-decl.cpp | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index bd79e56b099..1fbe6b3a1a4 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4761,7 +4761,9 @@ void Parser::ParseFunctionDeclarator(Declarator &D, 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]. diff --git a/clang/test/Parser/cxx0x-decl.cpp b/clang/test/Parser/cxx0x-decl.cpp index d74b337b313..1da7dd28331 100644 --- a/clang/test/Parser/cxx0x-decl.cpp +++ b/clang/test/Parser/cxx0x-decl.cpp @@ -41,3 +41,11 @@ struct SS { }; 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; } |

