17 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: echo 'struct X {}; struct Y : X { friend int f(Y); };' > %t/a.h4// RUN: echo 'module a { header "a.h" }' > %t/map5// RUN: %clang_cc1 -fmodules -x c++ -emit-module -fmodule-name=a %t/map -o %t/a.pcm6// RUN: %clang_cc1 -fmodules -x c++ -verify -fmodule-file=%t/a.pcm %s -fno-modules-error-recovery7 8struct X;9struct Y;10 11// Ensure that we can't use the definitions of X and Y, since we've not imported module a.12Y *yp;13X *xp = yp; // expected-error {{cannot initialize}}14_Static_assert(!__is_convertible(Y*, X*), "");15X &xr = *yp; // expected-error {{unrelated type}}16int g(Y &y) { f(y); } // expected-error {{undeclared identifier 'f'}}17