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


>>>>> John Carr <jfc@tiac.net> writes:

> "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.

Huh?  'class C & restrict' makes perfect sense to me.  & is parsed just
like * in a declarator.

>> > 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.

Initially, the easy approach would be for it to be ignored in overloading.
It might be useful to define separate restrict/non-restrict versions, but
you can't use alias analysis in overload resolution, so the restrict
version would only be called for arguments that already have restrict
applied.

Jason


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