re PR c++/68049 (template instantiation involving may_alias defines symbol twice)
PR c++/68049 * tree.c (strip_typedefs): Use DECL_ORIGINAL_TYPE. From-SVN: r233715
This commit is contained in:
parent
798e2a8ed8
commit
6284a979db
@ -1,3 +1,8 @@
|
|||||||
|
2016-02-25 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/68049
|
||||||
|
* tree.c (strip_typedefs): Use DECL_ORIGINAL_TYPE.
|
||||||
|
|
||||||
2016-02-25 Patrick Palka <ppalka@gcc.gnu.org>
|
2016-02-25 Patrick Palka <ppalka@gcc.gnu.org>
|
||||||
|
|
||||||
PR c++/69736
|
PR c++/69736
|
||||||
|
@ -1447,7 +1447,15 @@ strip_typedefs (tree t, bool *remove_attributes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
{
|
||||||
|
if (typedef_variant_p (t))
|
||||||
|
/* Explicitly get the underlying type, as TYPE_MAIN_VARIANT doesn't
|
||||||
|
strip typedefs with attributes. */
|
||||||
|
result = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (TYPE_NAME (t)));
|
||||||
|
else
|
||||||
result = TYPE_MAIN_VARIANT (t);
|
result = TYPE_MAIN_VARIANT (t);
|
||||||
|
}
|
||||||
|
gcc_assert (!typedef_variant_p (result));
|
||||||
if (TYPE_USER_ALIGN (t) != TYPE_USER_ALIGN (result)
|
if (TYPE_USER_ALIGN (t) != TYPE_USER_ALIGN (result)
|
||||||
|| TYPE_ALIGN (t) != TYPE_ALIGN (result))
|
|| TYPE_ALIGN (t) != TYPE_ALIGN (result))
|
||||||
{
|
{
|
||||||
|
22
gcc/testsuite/g++.dg/ext/attribute-may-alias-3.C
Normal file
22
gcc/testsuite/g++.dg/ext/attribute-may-alias-3.C
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// PR c++/68049
|
||||||
|
// { dg-do compile { target c++11 } }
|
||||||
|
|
||||||
|
template <typename T> struct Bar
|
||||||
|
{
|
||||||
|
using type = T;
|
||||||
|
};
|
||||||
|
template <typename T> struct Foo
|
||||||
|
{
|
||||||
|
typedef typename Bar<T>::type alias_type [[gnu::may_alias]];
|
||||||
|
|
||||||
|
alias_type operator()() { return {}; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T> void print(T) {}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
print(Foo<int>()());
|
||||||
|
print(0);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user