Topic: hole in type system


Author: Alexander Gootman <gtm@cer.nsk.su>
Date: Fri, 05 Nov 93 12:11:38 +0300
Raw View
In article <1993Oct26.223737.240@lia.com> daniel@lia.com writes:
>I believe the following illustrates this case:
>      struct base { /* ... */ };
>      struct derived : base { /* ... */ };
>      void f(base & b)
>      int main(void)
>      {
>       derived d;
>       f(d);
>      }
>
>Example #1 requires:
>
>       derived  --> derived &
>       derived& --> base &
>
>To prove that this is illegal (as it should be)

===> See ARM, p.154: "If initializer for a reference of type T
     is an lvalue of type T or derived from T for which T is accessible base,
     the reference will refer to the initializer; ..."

Alexander A. Gootman    Novosibirsk, Russia