This is the mail archive of the gcc@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]

Re: Implementing "restrict", and other alias questions



> > Another issue is references: Is
> > 
> >   void f(class C restrict &);
> > 
> > valid.

Adopting the C rules with minimal changes, the reference is
irrelevant.  The declaration is valid if and only if it is valid
without the "&".

"class C * restrict &" declares a reference to restrict-qualified
pointer to class C.  "class C restrict &" is invalid because restrict
only applies to pointer types.

If references were first class objects like pointers then restricted
references (which are not aliased by any other pointer or reference)
would be possible, but otherwise I can't think of a general way to
declare one without adding yet another ambiguity or special case to
C++ parsing.

> > If so, how does restrict interfere with function overloading?

> In the same way that `register' interferes, that is, not at all.

Restrict is a type qualifier, not a storage class specification.  A
special rule would be needed to make it not affect overloading.



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