[all-commits] [llvm/llvm-project] fb615c: [Clang][Sema] Diagnose declarative nested-name-spe...

Krystian Stasiowski via All-commits all-commits at lists.llvm.org
Tue Feb 20 10:25:23 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fb615cf3b9c2d887441a4c0cca326eddc592351a
      https://github.com/llvm/llvm-project/commit/fb615cf3b9c2d887441a4c0cca326eddc592351a
  Author: Krystian Stasiowski <sdkrystian at gmail.com>
  Date:   2024-02-20 (Tue, 20 Feb 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaDecl.cpp
    A clang/test/CXX/expr/expr.prim/expr.prim.id/expr.prim.id.qual/p3.cpp
    M clang/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp

  Log Message:
  -----------
  [Clang][Sema] Diagnose declarative nested-name-specifiers naming alias templates (#80842)

According to [expr.prim.id.qual] p3:
> The _nested-name-specifier_ `​::` nominates the global namespace. A
_nested-name-specifier_ with a _computed-type-specifier_ nominates the
type denoted by the _computed-type-specifier_, which shall be a class or
enumeration type. **If a _nested-name-specifier_ `N` is declarative and
has a _simple-template-id_ with a template argument list `A` that
involves a template parameter, let `T` be the template nominated by `N`
without `A`. `T` shall be a class template.**

Meaning, the out-of-line definition of `A::f` in the following example
is ill-formed:
```
template<typename T>
struct A 
{ 
    void f(); 
};

template<typename T>
using B = A<T>;

template<typename T>
void B<T>::f() { } // error: a declarative nested name specifier cannot name an alias template
```

This patch diagnoses such cases as an extension (in group `alias-template-in-declaration-name`).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list