================
@@ -3307,6 +3307,29 @@ void Sema::CheckShadowInheritedFields(const 
SourceLocation &Loc,
   }
 }
 
+template <typename AttrType>
+inline static bool HasAttribute(const QualType &T) {
----------------
a-tarasyuk wrote:

@erichkeane The main concern in the issue description is that the private field 
`s` isn't triggering the unused warning. I couldn't find the relevant 
specification for it, so the question remains: should the private field `s` 
trigger an unused warning, or should the issue be closed?

```cpp
class [[gnu::warn_unused]] S
{
public:
    S();
};

void f()
{
    int i = 0; // unused variable 'i'
    S s;       // unused variable 's'
}

class C
{
private:
    const int i = 0; // private field 'i' is not used
    const S s;       // ok
};
```

https://github.com/llvm/llvm-project/pull/120734
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to