luken-google updated this revision to Diff 455620. luken-google added a comment.
Responding to feedback. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132503/new/ https://reviews.llvm.org/D132503 Files: clang/docs/ReleaseNotes.rst clang/lib/Parse/ParseTemplate.cpp clang/test/Parser/cxx-concepts-requires-clause.cpp Index: clang/test/Parser/cxx-concepts-requires-clause.cpp =================================================================== --- clang/test/Parser/cxx-concepts-requires-clause.cpp +++ clang/test/Parser/cxx-concepts-requires-clause.cpp @@ -12,6 +12,7 @@ struct AA; enum E : int; static int x; + static constexpr int z = 16; template <typename> requires true void Mfoo(); @@ -24,6 +25,8 @@ template <typename TT> requires true using MQ = M<TT>; + + constexpr int bazz() requires (z == 16); }; template <typename T> requires (!0) @@ -56,6 +59,9 @@ template <typename T> requires true using Q = A<T>; +template<typename T> requires (!0) +constexpr int A<T>::bazz() requires (z == 16) { return z; } + struct C { template <typename> requires true void Mfoo(); Index: clang/lib/Parse/ParseTemplate.cpp =================================================================== --- clang/lib/Parse/ParseTemplate.cpp +++ clang/lib/Parse/ParseTemplate.cpp @@ -289,8 +289,14 @@ LateParsedAttrList LateParsedAttrs(true); if (DeclaratorInfo.isFunctionDeclarator()) { - if (Tok.is(tok::kw_requires)) + if (Tok.is(tok::kw_requires)) { + CXXScopeSpec ScopeSpec = DeclaratorInfo.getCXXScopeSpec(); + DeclaratorScopeObj DeclScopeObj(*this, ScopeSpec); + if (ScopeSpec.isValid() && + Actions.ShouldEnterDeclaratorScope(getCurScope(), ScopeSpec)) + DeclScopeObj.EnterDeclaratorScope(); ParseTrailingRequiresClause(DeclaratorInfo); + } MaybeParseGNUAttributes(DeclaratorInfo, &LateParsedAttrs); } Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -167,8 +167,8 @@ (C++14 [dcl.constexpr]p6 (CWG DR647/CWG DR1358)) - Correctly defer dependent immediate function invocations until template instantiation. This fixes `GH55601 <https://github.com/llvm/llvm-project/issues/55601>`_. - - +- Class member variables are now in scope when parsing requires clauses. Fixes + `GH55216 <https://github.com/llvm/llvm-project/issues/55216>`_. C++2b Feature Support ^^^^^^^^^^^^^^^^^^^^^
Index: clang/test/Parser/cxx-concepts-requires-clause.cpp =================================================================== --- clang/test/Parser/cxx-concepts-requires-clause.cpp +++ clang/test/Parser/cxx-concepts-requires-clause.cpp @@ -12,6 +12,7 @@ struct AA; enum E : int; static int x; + static constexpr int z = 16; template <typename> requires true void Mfoo(); @@ -24,6 +25,8 @@ template <typename TT> requires true using MQ = M<TT>; + + constexpr int bazz() requires (z == 16); }; template <typename T> requires (!0) @@ -56,6 +59,9 @@ template <typename T> requires true using Q = A<T>; +template<typename T> requires (!0) +constexpr int A<T>::bazz() requires (z == 16) { return z; } + struct C { template <typename> requires true void Mfoo(); Index: clang/lib/Parse/ParseTemplate.cpp =================================================================== --- clang/lib/Parse/ParseTemplate.cpp +++ clang/lib/Parse/ParseTemplate.cpp @@ -289,8 +289,14 @@ LateParsedAttrList LateParsedAttrs(true); if (DeclaratorInfo.isFunctionDeclarator()) { - if (Tok.is(tok::kw_requires)) + if (Tok.is(tok::kw_requires)) { + CXXScopeSpec ScopeSpec = DeclaratorInfo.getCXXScopeSpec(); + DeclaratorScopeObj DeclScopeObj(*this, ScopeSpec); + if (ScopeSpec.isValid() && + Actions.ShouldEnterDeclaratorScope(getCurScope(), ScopeSpec)) + DeclScopeObj.EnterDeclaratorScope(); ParseTrailingRequiresClause(DeclaratorInfo); + } MaybeParseGNUAttributes(DeclaratorInfo, &LateParsedAttrs); } Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -167,8 +167,8 @@ (C++14 [dcl.constexpr]p6 (CWG DR647/CWG DR1358)) - Correctly defer dependent immediate function invocations until template instantiation. This fixes `GH55601 <https://github.com/llvm/llvm-project/issues/55601>`_. - - +- Class member variables are now in scope when parsing requires clauses. Fixes + `GH55216 <https://github.com/llvm/llvm-project/issues/55216>`_. C++2b Feature Support ^^^^^^^^^^^^^^^^^^^^^
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits