[PATCH] D29599: Clang Changes for alloc_align

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 13 08:36:28 PST 2017


erichkeane added a comment.

In https://reviews.llvm.org/D29599#674772, @ahatanak wrote:

> Can this attribute be used on c++ template methods? Is the following code valid?
>
>   template<class T>
>   struct S {
>     T foo(int a)  __attribute__((alloc_align(1)));
>   };
>


Yes it can, however that example will NOT compile.  First, on member functions you cannot use alloc_align to refer to the 'this' function.  Second, the return value must be a pointer, so if remove_pointer<T> == T, this will fail.


https://reviews.llvm.org/D29599





More information about the cfe-commits mailing list