[all-commits] [llvm/llvm-project] 9c1293: [clang][test] Avoid some C++14 warnings in discrim...

Timm Baeder via All-commits all-commits at lists.llvm.org
Tue Jul 8 23:31:49 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c12931b70e182cb83f0e5f7dcdb835d825a6b2e
      https://github.com/llvm/llvm-project/commit/9c12931b70e182cb83f0e5f7dcdb835d825a6b2e
  Author: Timm Baeder <tbaeder at redhat.com>
  Date:   2025-07-09 (Wed, 09 Jul 2025)

  Changed paths:
    M clang/test/SemaCXX/discrim-union.cpp

  Log Message:
  -----------
  [clang][test] Avoid some C++14 warnings in discrim-union.cpp (#146829)

Before this patch, we emitted a bunch of irrelevant (to this test)
warnings:
```
  ../clang/test/SemaCXX/discrim-union.cpp:49:24: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
   49 |     constexpr const T &get(select<0>) { return val; }
      |                        ^
      |                                       const
../clang/test/SemaCXX/discrim-union.cpp:50:104: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
   50 |     template<unsigned N> constexpr const decltype(static_cast<const rest_t&>(rest).get(select<N-1>{})) get(select<N>) {
      |                                                                                                        ^
      |                                                                                                                       const
../clang/test/SemaCXX/discrim-union.cpp:82:22: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
   82 |   constexpr unsigned index() noexcept { return elem; }
      |                      ^
      |                              const
../clang/test/SemaCXX/discrim-union.cpp:88:33: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
   88 |   constexpr const_get_result<N> get() {
      |                                 ^
      |                                       const
../clang/test/SemaCXX/discrim-union.cpp:96:22: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const]
   96 |   constexpr const U &get() {
      |                      ^
      |                            const
5 warnings generated.
```



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