function overloading on __restrict__

Marc Glisse marc.glisse@inria.fr
Fri Mar 18 17:04:00 GMT 2011


On Fri, 18 Mar 2011, Matthias Kretz wrote:

> it seems overloading on __restrict__ is not possible. I.e. GCC complains
> about:
> void foo(float *__restrict__ mem) const;
> void foo(float *mem) const;
>
> This, to me, seems to have a very valid use case. Also the AIX C++ compiler
> docs (
> http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=%2Fcom.ibm.vacpp7a.doc%2Flanguage%2Fref%2Fclrc03restrict_type_qualifier.htm)
> specify "The __restrict__ qualifier also affects parameter type specifications
> for overloaded functions in the same way as a cv-qualifier, thereby affecting
> the overload set."

Please read this page more carefully.

void foo(float *const mem) const;
void foo(float *mem) const;
fails.

void foo(float *__restrict__* mem) const;
void foo(float **mem) const;
works.

-- 
Marc Glisse



More information about the Gcc-help mailing list