Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / diagnostic / static_assert1.C
blobfecf3cc51a09679033878b38ba304e6f6d8ee6c4
1 // PR c++/97518
2 // { dg-do compile { target c++17 } }
4 template <typename T, typename U> struct is_same { static constexpr bool value = false; };
5 template <typename T> struct is_same<T, T> { static constexpr bool value = true; };
7 template <typename T> using some_metafunction_t = T;
9 template <typename T>
10 void foo(T ) {
11     using X = T*;
12     using Y = some_metafunction_t<T>;
14     static_assert(is_same<X, Y>::value); // { dg-error "static assertion failed" }
15     // { dg-message {.is_same<int\*, int>::value. evaluates to false} "" { target *-*-* } .-1 }
16     static_assert(is_same<X, Y>::value, "foo"); // { dg-error "static assertion failed: foo" }
17     // { dg-message {.is_same<int\*, int>::value. evaluates to false} "" { target *-*-* } .-1 }
18     static_assert(is_same<X, X>::value && is_same<X, Y>::value); // { dg-error "static assertion failed" }
19     // { dg-message {.is_same<int\*, int>::value. evaluates to false} "" { target *-*-* } .-1 }
20     static_assert(is_same<X, Y>::value && is_same<X, X>::value); // { dg-error "static assertion failed" }
21     // { dg-message {.is_same<int\*, int>::value. evaluates to false} "" { target *-*-* } .-1 }
22     static_assert(is_same<X, X>::value
23                   && is_same<Y, Y>::value
24                   && is_same<X, Y>::value); // { dg-error "static assertion failed" }
25     // { dg-message {.is_same<int\*, int>::value. evaluates to false} "" { target *-*-* } .-1 }
28 void bar() {
29     foo(0);