r218590 - Fix "unsupported friend" diagnostic to also appear for friend functions with dependent scopes.
Richard Smith
richard-llvm at metafoo.co.uk
Sun Sep 28 22:57:29 PDT 2014
Author: rsmith
Date: Mon Sep 29 00:57:29 2014
New Revision: 218590
URL: http://llvm.org/viewvc/llvm-project?rev=218590&view=rev
Log:
Fix "unsupported friend" diagnostic to also appear for friend functions with dependent scopes.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p5.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=218590&r1=218589&r2=218590&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Sep 29 00:57:29 2014
@@ -12242,8 +12242,12 @@ NamedDecl *Sema::ActOnFriendFunctionDecl
}
// 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;
Modified: cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p5.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p5.cpp?rev=218590&r1=218589&r2=218590&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p5.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.decls/temp.friend/p5.cpp Mon Sep 29 00:57:29 2014
@@ -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 {};
More information about the cfe-commits
mailing list