[all-commits] [llvm/llvm-project] e75b58: [Clang][Sema] Do not add implicit 'const' when mat...

Krystian Stasiowski via All-commits all-commits at lists.llvm.org
Mon May 20 11:51:20 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e75b58cfc666fc168d05580d2b7fd274830a4dd0
      https://github.com/llvm/llvm-project/commit/e75b58cfc666fc168d05580d2b7fd274830a4dd0
  Author: Krystian Stasiowski <sdkrystian at gmail.com>
  Date:   2024-05-20 (Mon, 20 May 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp
    A clang/test/CXX/temp/temp.spec/temp.expl.spec/p12.cpp

  Log Message:
  -----------
  [Clang][Sema] Do not add implicit 'const' when matching constexpr function template explicit specializations after C++14 (#92449)

Clang incorrectly accepts the following when using C++14 or later:
```
struct A {
  template<typename T>
  void f() const;

  template<>
  constexpr void f<int>();
};
```
Non-static member functions declared `constexpr` are only implicitly
`const` in C++11. This patch makes clang reject the explicit
specialization of `f` in language modes after C++11.



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