1 // RUN: %clang_cc1 %s -triple i686-pc-win32 -std=c++11 -Wmicrosoft -fms-compatibility -verify
2 // RUN: not %clang_cc1 %s -triple i686-pc-win32 -std=c++11 -Wmicrosoft -fms-compatibility -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
5 namespace name_at_tu_scope
{
7 friend struct X
; // expected-warning-re {{unqualified friend declaration {{.*}} is a Microsoft extension}}
8 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:17-[[@LINE-1]]:17}:"::"
12 namespace enclosing_friend_decl
{
16 friend struct B
; // expected-warning-re {{unqualified friend declaration {{.*}} is a Microsoft extension}}
17 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:17-[[@LINE-1]]:17}:"enclosing_friend_decl::"
23 static void f() { ns::A x
; }
27 namespace enclosing_friend_qualified
{
31 friend struct enclosing_friend_qualified::B
; // Adding name specifiers fixes it.
37 static void f() { ns::A x
; }
41 namespace enclosing_friend_no_tag
{
45 friend B
; // Removing the tag decl fixes it.
51 static void f() { ns::A x
; }
55 namespace enclosing_friend_func
{
59 // Amusingly, in MSVC, this declares ns::f(), and doesn't find the outer f().
62 A(); // expected-note {{declared protected here}}
65 void f() { ns::A x
; } // expected-error {{calling a protected constructor of class 'enclosing_friend_func::ns::A'}}
68 namespace test_nns_fixit_hint
{
75 friend struct X
; // expected-warning-re {{unqualified friend declaration {{.*}} is a Microsoft extension}}
76 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:17-[[@LINE-1]]:17}:"name1::name2::"
83 // A friend declaration injects a forward declaration into the nearest enclosing
85 namespace friend_as_a_forward_decl
{