This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/50800 (ICE with may_alias and templates)
- From: Markus Trippelsdorf <markus at trippelsdorf dot de>
- To: Jason Merrill <jason at redhat dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 29 Apr 2015 13:41:53 +0200
- Subject: Re: C++ PATCH for c++/50800 (ICE with may_alias and templates)
- Authentication-results: sourceware.org; auth=none
- References: <55391529 dot 6090904 at redhat dot com> <CAMe9rOpW1sGisK9-0BAyNugonTo+qOtyJDwVPn-j5WCjHHgzQQ at mail dot gmail dot com> <553F9C40 dot 7040101 at redhat dot com>
On 2015.04.28 at 10:42 -0400, Jason Merrill wrote:
> On 04/23/2015 01:45 PM, H.J. Lu wrote:
> > On Thu, Apr 23, 2015 at 8:52 AM, Jason Merrill <jason@redhat.com> wrote:
> >> We try to strip attributes that aren't reflected in mangling from template
> >> arguments, but were failing to do that in this case. Fixed by making
> >> strip_typedefs strip such attributes as well.
> >>
> >> Tested x86_64-pc-linux-gnu, applying to trunk.
> >
> > This caused:
> >
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65865
>
> This turned out to be because of a thinko in apply_identity_attributes;
> we weren't actually applying the identity attributes. Fixed thus.
I'm getting hundreds of new warnings when building LLVM, e.g.:
trippels@gcc2-power8 Sema % cat AttributeList.ii
template <typename> struct A;
template <typename _Up> struct A<_Up *> { typedef _Up type; };
template <typename T> struct B { typedef typename A<T>::type type; };
template <typename> struct C;
template <typename From> struct C<const From> {
typedef typename B<From>::type SimpleType;
};
template <class> struct D { typedef int ret_type; };
template <class From> struct F {
typedef typename D<typename C<From>::SimpleType>::ret_type ret_type;
};
template <class, class Y> typename F<Y>::ret_type cast(Y &);
class CompoundStmt;
class alignas(8) Stmt {
Stmt *Children[];
CompoundStmt *getBlock() const { cast<CompoundStmt>(Children[0]); }
};
trippels@gcc2-power8 Sema % g++ -c -std=c++11 AttributeList.ii
AttributeList.ii: In instantiation of âstruct F<Stmt* const>â:
AttributeList.ii:12:51: required by substitution of âtemplate<class, class Y> typename F<Y>::ret_type cast(Y&) [with <template-parameter-1-1> = CompoundStmt; Y = Stmt* const]â
AttributeList.ii:16:66: required from here
AttributeList.ii:10:62: warning: ignoring attributes applied to âStmtâ after definition [-Wattributes]
typedef typename D<typename C<From>::SimpleType>::ret_type ret_type;
^
AttributeList.ii:10:62: warning: ignoring attributes on template argument âC<Stmt* const>::SimpleType {aka Stmt}â
--
Markus