Skip to content

Commit

Permalink
[clang][Interp] Remove assertion to fix comma operators...
Browse files Browse the repository at this point in the history
... involving function pointers on the RHS. The conversion to
an RValue _can_ be requested, but we just ignore it.
  • Loading branch information
tbaederr committed Feb 19, 2024
1 parent 4b483ec commit a2535a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion clang/lib/AST/Interp/EvalEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ template <> bool EvalEmitter::emitRet<PT_FnPtr>(const SourceInfo &Info) {
if (!isActive())
return true;
// Function pointers cannot be converted to rvalues.
assert(!ConvertResultToRValue);
EvalResult.setFunctionPointer(S.Stk.pop<FunctionPointer>());
return true;
}
Expand Down
10 changes: 10 additions & 0 deletions clang/test/AST/Interp/comma.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter
// expected-no-diagnostics

// PR6076
void f();
void (&g)() = (void(), f);

int a[1];
int (&b)[1] = (void(), a);

0 comments on commit a2535a5

Please sign in to comment.