1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
14 friend int x
; // expected-error {{'friend' used outside of class}}
16 friend class D
{}; // expected-error {{'friend' used outside of class}}
23 // 'A' here should refer to the declaration above.
27 #if __cplusplus <= 199711L
28 // expected-warning@-2 {{unelaborated friend declaration is a C++11 extension; specify 'class' to befriend 'C'}}
32 #if __cplusplus <= 199711L
33 // expected-warning@-2 {{unelaborated friend declaration is a C++11 extension; specify 'union' to befriend 'U'}}
37 #if __cplusplus <= 199711L
38 // expected-warning@-2 {{non-class friend type 'int' is a C++11 extension}}
43 void f(A
*a
) { a
->f(); }
46 inline void bar() {} // expected-note {{previous definition is here}}
48 friend void bar() {} // expected-error {{redefinition of 'bar'}}
54 template <typename t1
, typename t2
> class some_template
;
55 friend // expected-error {{'friend' used outside of class}}
56 some_template
<foo
, bar
>& // expected-error {{use of undeclared identifier 'foo'}}
57 ; // expected-error {{expected unqualified-id}}