Before this change a default template argument for a non-type template parameter was evaluated and checked immediately after it is met by parser. In some cases it is too early. Fixes https://github.com/llvm/llvm-project/issues/62224 Fixes https://github.com/llvm/llvm-project/issues/62596 Reviewed By: shafik, erichkeane, cor3ntin Differential Revision: https://reviews.llvm.org/D150108
18 lines
376 B
C++
18 lines
376 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
|
|
|
|
struct foo {
|
|
static constexpr bool bar() {
|
|
return true;
|
|
}
|
|
|
|
template<bool B = bar()>
|
|
static constexpr bool baz() {
|
|
return B;
|
|
}
|
|
};
|
|
static_assert(foo::baz(), "");
|
|
|
|
// expected-no-diagnostics
|