[PATCH] D16579: Warn if friend function depends on template parameters.

Serge Pavlov via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 26 06:55:50 PST 2016


sepavloff created this revision.
sepavloff added a subscriber: cfe-commits.

Declaration of friend function may depend on template parameters,
however it does not become a template function:

    template<typename T> class C1 {
      friend void func(T x);
    };

It may be not obvious for user, so compiler could emit a warning in
such case. This patch implements appropriate warning, the wording is
taken from GCC message. The patch fixes PR23342.

http://reviews.llvm.org/D16579

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  test/CXX/drs/dr3xx.cpp
  test/CXX/drs/dr5xx.cpp
  test/CXX/temp/temp.decls/temp.friend/p1.cpp
  test/PCH/cxx-templates.cpp
  test/PCH/cxx-templates.h
  test/SemaCXX/friend.cpp
  test/SemaCXX/overload-call.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16579.45988.patch
Type: text/x-patch
Size: 9035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160126/b147a4c2/attachment.bin>


More information about the cfe-commits mailing list