public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Markus Trippelsdorf <markus@trippelsdorf.de>
To: Jason Merrill <jason@redhat.com>
Cc: "H.J. Lu" <hjl.tools@gmail.com>,
	gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: C++ PATCH for c++/50800 (ICE with may_alias and templates)
Date: Wed, 29 Apr 2015 11:52:00 -0000	[thread overview]
Message-ID: <20150429114153.GA32249@x4> (raw)
In-Reply-To: <553F9C40.7040101@redhat.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

  reply	other threads:[~2015-04-29 11:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23 15:52 Jason Merrill
2015-04-23 17:45 ` H.J. Lu
2015-04-28 14:58   ` Jason Merrill
2015-04-29 11:52     ` Markus Trippelsdorf [this message]
2015-04-29 21:07       ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150429114153.GA32249@x4 \
    --to=markus@trippelsdorf.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=jason@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).