clang/test/Sema/GH126231.cpp
raw| 1 | // RUN: %clang_cc1 -std=c++20 -Wno-ignored-attributes -Wno-unused-value -verify %s |
| 2 | // expected-no-diagnostics |
| 3 | namespace std { |
| 4 | template <class T> |
| 5 | constexpr const T& as_const(T&) noexcept; |
| 6 | |
| 7 | // We need two declarations to see the error for some reason. |
| 8 | template <class T> void as_const(const T&&) noexcept = delete; |
| 9 | template <class T> void as_const(const T&&) noexcept; |
| 10 | } |
| 11 | |
| 12 | namespace GH126231 { |
| 13 | |
| 14 | void test() { |
| 15 | int a = 1; |
| 16 | std::as_const(a); |
| 17 | } |
| 18 | } |