[clang] Reapply "[Clang][Sema] Earlier type checking for builtin unary operators (#90500)" (PR #92283)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu May 16 09:36:32 PDT 2024
erichkeane wrote:
> Hi @sdkrystian - this appears to break in a circumstance where a custom iterator class defines the postfix operator:
>
> ```
> FAILED: host_x64/obj/src/lib/zbitl/tests/zbitl-unittests.mem-config-test.cc.o
> ../../prebuilt/third_party/clang/custom/bin/clang++ -MD -MF host_x64/obj/src/lib/zbitl/tests/zbitl-unittests.mem-config-test.cc.o.d -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -DRAPIDJSON_HAS_STDSTRING -DRAPIDJSON_HAS_CXX11_RANGE_FOR -DRAPIDJSON_HAS_CXX11_RVALUE_REFS -DRAPIDJSON_HAS_CXX11_TYPETRAITS -DRAPIDJSON_HAS_CXX11_N...
> In file included from ../../src/lib/zbitl/tests/mem-config-test.cc:6:
> ../../src/lib/zbitl/include/lib/zbitl/items/mem-config.h:61:7: error: expression is not assignable
> 61 | ++this;
> | ^ ~~~~
> 1 error generated.
> ```
>
> I went ahead and attached a reproducer. Could you please revert this change and investigate?
>
> [clang-crashreports.tar.gz](https://github.com/llvm/llvm-project/files/15337912/clang-crashreports.tar.gz)
If the iterator is trying to call its own increment operator, that probably should be `++*this`.
At the moment it is trying to do something that I'd be shocked if it isn't UB, which is incrementing 'this' itself, which is a pointer.
https://github.com/llvm/llvm-project/pull/92283
More information about the cfe-commits
mailing list