aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorKrystian Stasiowski <sdkrystian@gmail.com>2024-04-11 11:23:24 -0400
committerGitHub <noreply@github.com>2024-04-11 11:23:24 -0400
commit198ffb85314f7741ed048de67d68ca83bb30e16e (patch)
tree190f0d4f4bf16998e42e5fa479c18b9ffa1f3af4 /clang/lib/Sema/SemaDecl.cpp
parent44718311dee486f1823876e8af9100afcc50041b (diff)
downloadllvm-198ffb85314f7741ed048de67d68ca83bb30e16e.zip
llvm-198ffb85314f7741ed048de67d68ca83bb30e16e.tar.gz
llvm-198ffb85314f7741ed048de67d68ca83bb30e16e.tar.bz2
[Clang][Sema] Implement approved resolution for CWG2858 (#88042)
The approved resolution for CWG2858 changes [expr.prim.id.qual] p2 sentence 2 to read: > A declarative _nested-name-specifier_ shall not have a _computed-type-specifier_. This patch implements the approved resolution. Since we don't consider _nested-name-specifiers_ in friend declarations to be declarative (yet), it currently isn't possible to write a test that would produce this diagnostic (`diagnoseQualifiedDeclaration` is never called if the `DeclContext` can't be computed). Nevertheless, tests were added which will produce the diagnostic once we start calling `diagnoseQualifiedDeclaration` for friend declarations.
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5a23179..a4699d6 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -6335,16 +6335,15 @@ bool Sema::diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC,
if (TST->isDependentType() && TST->isTypeAlias())
Diag(Loc, diag::ext_alias_template_in_declarative_nns)
<< SpecLoc.getLocalSourceRange();
- } else if (T->isDecltypeType()) {
+ } else if (T->isDecltypeType() || T->getAsAdjusted<PackIndexingType>()) {
// C++23 [expr.prim.id.qual]p2:
// [...] A declarative nested-name-specifier shall not have a
- // decltype-specifier.
+ // computed-type-specifier.
//
- // FIXME: This wording appears to be defective as it does not forbid
- // declarative nested-name-specifiers with pack-index-specifiers.
- // See https://github.com/cplusplus/CWG/issues/499.
- Diag(Loc, diag::err_decltype_in_declarator)
- << SpecLoc.getTypeLoc().getSourceRange();
+ // CWG2858 changed this from 'decltype-specifier' to
+ // 'computed-type-specifier'.
+ Diag(Loc, diag::err_computed_type_in_declarative_nns)
+ << T->isDecltypeType() << SpecLoc.getTypeLoc().getSourceRange();
}
}
} while ((SpecLoc = SpecLoc.getPrefix()));