mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
c++: add fixed test [PR124389]
This one is also fixed by r16-7055. The testcases from that commit utilize the concepts satisfaction cache, whereas this one utilizes the constexpr call cache. PR c++/124389 PR c++/122494 gcc/testsuite/ChangeLog: * g++.dg/cpp0x/static_assert18.C: New test.
This commit is contained in:
28
gcc/testsuite/g++.dg/cpp0x/static_assert18.C
Normal file
28
gcc/testsuite/g++.dg/cpp0x/static_assert18.C
Normal file
@@ -0,0 +1,28 @@
|
||||
// PR c++/124389
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
template <typename T> struct Empty {};
|
||||
|
||||
template <typename T>
|
||||
constexpr bool test(T) noexcept { return true; }
|
||||
|
||||
template <typename T>
|
||||
struct always_true {
|
||||
static constexpr bool value = true;
|
||||
static_assert(test(Empty<T>{}), "BUG");
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct AAA {
|
||||
template <typename U, bool = always_true<U>::value>
|
||||
AAA(U) {}
|
||||
};
|
||||
|
||||
template <int (*U) (AAA<int>)>
|
||||
void test_function() {
|
||||
auto r = U(AAA<int>(1));
|
||||
}
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user