19 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5struct B0;6 7class A {8 friend class B {}; // expected-error {{cannot define a type in a friend declaration}}9 friend int;10#if __cplusplus <= 199711L11 // expected-warning@-2 {{non-class friend type 'int' is a C++11 extension}}12#endif13 friend B0;14#if __cplusplus <= 199711L15 // expected-warning@-2 {{unelaborated friend declaration is a C++11 extension; specify 'struct' to befriend 'B0'}}16#endif17 friend class C; // okay18};19