summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-09-29 05:57:29 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-09-29 05:57:29 +0000
commit04b35e9beb4144922b68137e21ccb718f1051f11 (patch)
tree68e95785f42246da6e2088fecab990b26731d346 /clang
parentb1cc7a8542e7f59a23e7b8169b448cbfb77f3976 (diff)
downloadbcm5719-llvm-04b35e9beb4144922b68137e21ccb718f1051f11.tar.gz
bcm5719-llvm-04b35e9beb4144922b68137e21ccb718f1051f11.zip
Fix "unsupported friend" diagnostic to also appear for friend functions with dependent scopes.
llvm-svn: 218590
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp6
-rw-r--r--clang/test/CXX/temp/temp.decls/temp.friend/p5.cpp8
2 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index acf7f2ac960..16e1b2f6f2c 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -12242,8 +12242,12 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D,
}
// Mark templated-scope function declarations as unsupported.
- if (FD->getNumTemplateParameterLists())
+ if (FD->getNumTemplateParameterLists() && SS.isValid()) {
+ Diag(FD->getLocation(), diag::warn_template_qualified_friend_unsupported)
+ << SS.getScopeRep() << SS.getRange()
+ << cast<CXXRecordDecl>(CurContext);
FrD->setUnsupportedFriend(true);
+ }
}
return ND;
diff --git a/clang/test/CXX/temp/temp.decls/temp.friend/p5.cpp b/clang/test/CXX/temp/temp.decls/temp.friend/p5.cpp
index b26abb64f83..c4f9d63b7c6 100644
--- a/clang/test/CXX/temp/temp.decls/temp.friend/p5.cpp
+++ b/clang/test/CXX/temp/temp.decls/temp.friend/p5.cpp
@@ -20,7 +20,7 @@ namespace test1 {
class C {
static void foo();
- template <class T> friend void A<T>::f();
+ template <class T> friend void A<T>::f(); // expected-warning {{not supported}}
};
template <class T> struct A {
@@ -42,7 +42,7 @@ namespace test2 {
class C {
static void foo();
- template <class T> friend void A<T>::g();
+ template <class T> friend void A<T>::g(); // expected-warning {{not supported}}
};
template <class T> struct A {
@@ -86,7 +86,7 @@ namespace test4 {
template <class V>
template <class U>
- friend void X<V>::operator+=(U);
+ friend void X<V>::operator+=(U); // expected-warning {{not supported}}
};
void test() {
@@ -96,7 +96,7 @@ namespace test4 {
namespace test5 {
template<template <class> class T> struct A {
- template<template <class> class U> friend void A<U>::foo();
+ template<template <class> class U> friend void A<U>::foo(); // expected-warning {{not supported}}
};
template <class> struct B {};
OpenPOWER on IntegriCloud