gcc/testsuite/g++.dg/ext/attribute-may-alias-3.C
raw| 1 | // PR c++/68049 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template <typename T> struct Bar |
| 5 | { |
| 6 | using type = T; |
| 7 | }; |
| 8 | template <typename T> struct Foo |
| 9 | { |
| 10 | typedef typename Bar<T>::type alias_type [[gnu::may_alias]]; |
| 11 | |
| 12 | alias_type operator()() { return {}; } |
| 13 | }; |
| 14 | |
| 15 | template <typename T> void print(T) {} |
| 16 | |
| 17 | int main() |
| 18 | { |
| 19 | print(Foo<int>()()); |
| 20 | print(0); |
| 21 | return 0; |
| 22 | } |