https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/90410
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/5chmidti approved this pull request.
https://github.com/llvm/llvm-project/pull/90410
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
5chmidti wrote:
> And in example that you provided there is no issue.
Alright, at least not a bugrprone issue. And the argument for a readability
issue (which is the direction I initially was going) would probably end in
someone saying `we use this to diagnose compile errors earlier, not
PiotrZSL wrote:
@5chmidti
I did some testing with this. And in example that you provided there is no
issue.
This is because if optional will be uninitialized, then this code won't compile
regardless if .value() or operator * is used.
Compiler will simply complain that expression is not
https://github.com/5chmidti commented:
Do we maybe want to explicitly match `decltype`, `sizeof`, `static_cast` etc.
instead of `typeLoc`?
Because I don't think we would want to ignore https://godbolt.org/z/r3bK961do
```c++
#include
constexpr std::optional foo() { return 42; }
constexpr int
llvmbot wrote:
@llvm/pr-subscribers-clang-tidy
Author: Piotr Zegar (PiotrZSL)
Changes
Ignore optionals in unevaluated context, like static_assert or decltype.
Closes #89593
---
Full diff: https://github.com/llvm/llvm-project/pull/90410.diff
3 Files Affected:
- (modified)
https://github.com/PiotrZSL created
https://github.com/llvm/llvm-project/pull/90410
Ignore optionals in unevaluated context, like static_assert or decltype.
Closes #89593
>From 7dcbe220d74f2be4ade8429e6c0e710d7d7c58a4 Mon Sep 17 00:00:00 2001
From: Piotr Zegar
Date: Sun, 28 Apr 2024 19:16:43