This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/50800 (ICE with may_alias and templates)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]