Skip to content

error: invalid argument type 'T *' to unary expression #93331

@dcci

Description

@dcci

After #90500 -- some of our internal code stopped compiling.

$ ~/llvm-build-upstream/bin/clang /tmp/Out.cpp
/tmp/Out.cpp:3:9: warning: #pragma once in main file [-Wpragma-once-outside-header]
    3 | #pragma once
      |         ^
/tmp/Out.cpp:65:14: error: invalid argument type 'T *' to unary expression
   65 |     *item_ = -item_;
      |              ^~~~~~
1 warning and 1 error generated.

File attached.
repro.cpp.txt

cc: @erichkeane / @sdkrystian

I don't exclude that our code might be incorrect, but I wonder why this only applies to operator- (and not operator+)

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions