https://bugs.llvm.org/show_bug.cgi?id=42854
Bug ID: 42854
Summary: Can't fully activate -Wconsumed using #pragma clang
diagnostic
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: com...@gmail.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
If you activate -Wconsumed using a pragma rather than on the command line, it
seemingly doesn't trigger the consumed analysis pass.
Given the following example code:
---
#pragma clang diagnostic error "-Wconsumed"
struct [[clang::consumable(unconsumed)]] Linear {
[[clang::return_typestate(unconsumed)]]
Linear() {}
[[clang::callable_when(consumed)]]
~Linear() {}
};
void a() {
Linear l;
}
---
Compiling the code as is, without passing -Wconsumed on the command line, I get
no warnings or errors.
The pragma does enable -Wconsumed warnings about malformed declarations: if I
e.g. comment out the consumable attribute on Linear, I get:
> error: consumed analysis attribute is attached to member of class 'Linear'
> which isn't marked as consumable [-Werror,-Wconsumed]
However, without commenting anything out, I expect this diagnostic from a():
> error: invalid invocation of method '~Linear' on object 'l' while it is in
> the 'unconsumed' state [-Werror,-Wconsumed]
I get this if and only if I pass -Wconsumed on the command line.
Tested on Compiler Explorer's "x86-64 clang (trunk)".
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs