aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/ParseDeclCXX.cpp2
-rw-r--r--test/Parser/cxx-friend.cpp12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index f684649f85..e1e81ec33d 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -455,7 +455,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
Action::TagKind TK;
if (Tok.is(tok::l_brace) || (getLang().CPlusPlus && Tok.is(tok::colon)))
TK = Action::TK_Definition;
- else if (Tok.is(tok::semi))
+ else if (Tok.is(tok::semi) && !DS.isFriendSpecified())
TK = Action::TK_Declaration;
else
TK = Action::TK_Reference;
diff --git a/test/Parser/cxx-friend.cpp b/test/Parser/cxx-friend.cpp
index 5bfaf2fdbc..ea30ddcbd0 100644
--- a/test/Parser/cxx-friend.cpp
+++ b/test/Parser/cxx-friend.cpp
@@ -3,3 +3,15 @@
class C {
friend class D;
};
+
+class A {
+public:
+ void f();
+};
+
+class B {
+ // 'A' here should refer to the declaration above.
+ friend class A;
+
+ void f(A *a) { a->f(); }
+};