v.g.vassilev added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:1496
         return false;
+      // 'static operator' functions are defined in headers; don't warn.
+      if (FD->isOverloadedOperator() &&
----------------
rsmith wrote:
> Why? Defining a static operator in a header sounds like a bug to me.
It seems we have some of these here:

include/llvm/ADT/PointerUnion.h:static bool operator==(PointerUnion<PT1, PT2> 
lhs, PointerUnion<PT1, PT2> rhs) {
include/llvm/ADT/PointerUnion.h:static bool operator!=(PointerUnion<PT1, PT2> 
lhs, PointerUnion<PT1, PT2> rhs) {
include/llvm/ADT/PointerUnion.h:static bool operator<(PointerUnion<PT1, PT2> 
lhs, PointerUnion<PT1, PT2> rhs) {
include/llvm/Transforms/Utils/ValueMapper.h:static inline RemapFlags 
operator|(RemapFlags LHS, RemapFlags RHS) {

If that's a bug, I will remove this check.


================
Comment at: lib/Sema/SemaDecl.cpp:6679
       NewTemplate->setInvalidDecl();
+    MarkUnusedFileScopedDecl(NewVD);
     ActOnDocumentableDecl(NewTemplate);
----------------
@rsmith, this forces the linkage to be computed and for some invalid code such 
as:

```
namespace { struct Internal {}; }
template<typename T> __declspec(dllimport) auto InternalAutoTypeVarTmpl = 
Internal();
```

we hit an assertion in (Sema::DeduceVariableDeclarationType, SemaDecl.cpp:9991) 
`assert(VDecl->isLinkageValid())` which assumes that the linkage wasn't 
computed. Should we relax/remove the assert there?


https://reviews.llvm.org/D29877



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to