From: Paolo Carlini Date: Thu, 13 Aug 2015 15:45:37 +0000 (+0000) Subject: re PR c++/53421 (__attribute__((__may_alias__)) prevents taking address of conversion... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=42b7febc53cac744c7d0c0ae6e2dae0876b7d896;p=gcc.git re PR c++/53421 (__attribute__((__may_alias__)) prevents taking address of conversion operator member function) 2015-08-13 Paolo Carlini PR c++/53421 * g++.dg/ext/attribute-may-alias-1.C: New. * g++.dg/ext/attribute-may-alias-2.C: Likewise. From-SVN: r226868 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c19d68a844..ef2d567f64e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-08-13 Paolo Carlini + + PR c++/53421 + * g++.dg/ext/attribute-may-alias-1.C: New. + * g++.dg/ext/attribute-may-alias-2.C: Likewise. + 2015-08-13 Matthew Wahab * gcc.target/aarch64/atomic-inst-cas.c: New. diff --git a/gcc/testsuite/g++.dg/ext/attribute-may-alias-1.C b/gcc/testsuite/g++.dg/ext/attribute-may-alias-1.C new file mode 100644 index 00000000000..24d2aab7615 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attribute-may-alias-1.C @@ -0,0 +1,15 @@ +// PR c++/53421 + +template< class T > +struct Y : T +{ } __attribute__((__may_alias__)); + +struct X +{ + operator Y& () { return *static_cast< Y* >(this); } +}; + +int main() +{ + &X::operator Y&; +} diff --git a/gcc/testsuite/g++.dg/ext/attribute-may-alias-2.C b/gcc/testsuite/g++.dg/ext/attribute-may-alias-2.C new file mode 100644 index 00000000000..d7e1fdfdd4a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attribute-may-alias-2.C @@ -0,0 +1,13 @@ +// PR c++/53421 + +template< class T > +struct Y : T +{ } __attribute__((__may_alias__)); + +struct X +{ + operator Y& (); +}; + +Y y = Y(); +X::operator Y& () { return *static_cast< Y* >(this); }