Skip to content

Commit 48c988c

Browse files
authored
[Clang] Only non-overloaded dereference expressions are lvalues (#93457)
Fix a regression introduced by #88740 Fixes #92275
1 parent 5fb3830 commit 48c988c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clang/lib/Sema/SemaOverload.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14363,7 +14363,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
1436314363
if (Fn.isInvalid())
1436414364
return ExprError();
1436514365
return CXXOperatorCallExpr::Create(Context, Op, Fn.get(), ArgsArray,
14366-
Context.DependentTy, VK, OpLoc,
14366+
Context.DependentTy, VK_PRValue, OpLoc,
1436714367
CurFPFeatureOverrides());
1436814368
}
1436914369

clang/test/SemaCXX/overloaded-operator.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,4 +691,15 @@ template <auto T> A<*T> operator *() { return {}; }
691691
// expected-error@-1 {{overloaded 'operator*' must have at least one parameter of class or enumeration type}}
692692
}
693693

694+
namespace GH92275 {
695+
696+
template <auto v>
697+
struct constant{};
698+
699+
template <auto x>
700+
auto operator *(constant<x>)
701+
{ return constant<(*x)>{}; }
702+
703+
}
704+
694705
#endif

0 commit comments

Comments
 (0)