[PATCH] D49085: [Sema] Emit a diagnostic for an invalid dependent function template specialization

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 19 12:49:41 PDT 2018


erik.pilkington added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:4111
+  "candidate template ignored: %select{template is not a function template"
+  "|is not a member of the enclosing namespace}0">;
 
----------------
rjmccall wrote:
> Your first explanation has a subject, but the second doesn't.  And I think it would be nice to suggest adding explicit scope qualification in the second case.
> 
> I assume non-templates have previously been filtered out?
Oh, no, good point. A non-template can still get into here:
```
namespace ns1 { template <class T> struct foo {}; }
namespace ns2 { int foo() {} } // bad diag: template is not a function template
using ns1::foo;
using ns2::foo;

template <class T> class A {
    friend void foo<T>() {}
};
```

I added this to the testcases.


https://reviews.llvm.org/D49085





More information about the cfe-commits mailing list