Skip to content

Commit

Permalink
[Clang] Only non-overloaded dereference expressions are lvalues (#93457)
Browse files Browse the repository at this point in the history
Fix a regression introduced by #88740

Fixes #92275
  • Loading branch information
cor3ntin authored May 27, 2024
1 parent 5fb3830 commit 48c988c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14363,7 +14363,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
if (Fn.isInvalid())
return ExprError();
return CXXOperatorCallExpr::Create(Context, Op, Fn.get(), ArgsArray,
Context.DependentTy, VK, OpLoc,
Context.DependentTy, VK_PRValue, OpLoc,
CurFPFeatureOverrides());
}

Expand Down
11 changes: 11 additions & 0 deletions clang/test/SemaCXX/overloaded-operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,4 +691,15 @@ template <auto T> A<*T> operator *() { return {}; }
// expected-error@-1 {{overloaded 'operator*' must have at least one parameter of class or enumeration type}}
}

namespace GH92275 {

template <auto v>
struct constant{};

template <auto x>
auto operator *(constant<x>)
{ return constant<(*x)>{}; }

}

#endif

0 comments on commit 48c988c

Please sign in to comment.