Skip to content

Commit

Permalink
[Sema][NFC] Add test for static_assert diagnistics with constexpr tem…
Browse files Browse the repository at this point in the history
…plate functions.

llvm-svn: 349755
  • Loading branch information
legrosbuffle committed Dec 20, 2018
1 parent 920936c commit 3416338
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions clang/test/SemaCXX/static-assert-cxx17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ struct S2 {
static inline constexpr bool var = global_inline_var<U, V>;
};

template <typename U, typename V>
inline constexpr bool constexpr_return_false() {
return false;
}

template <typename U, typename V>
void foo() {
static_assert(S1<U, V>::value);
Expand Down Expand Up @@ -92,6 +97,8 @@ void foo6() {
// expected-error@-1{{static_assert failed due to requirement '(X<int> const[0]){} == nullptr'}}
static_assert(sizeof(X<decltype(X<typename T::T>().X<typename T::T>::~X())>) == 0);
// expected-error@-1{{static_assert failed due to requirement 'sizeof(X<void>) == 0'}}
static_assert(constexpr_return_false<typename T::T, typename T::U>());
// expected-error@-1{{static_assert failed due to requirement 'constexpr_return_false<int, float>()'}}
}
template void foo6<ExampleTypes>();
// expected-note@-1{{in instantiation of function template specialization 'foo6<ExampleTypes>' requested here}}

0 comments on commit 3416338

Please sign in to comment.