Skip to content

Commit a2535a5

Browse files
committed
[clang][Interp] Remove assertion to fix comma operators...
... involving function pointers on the RHS. The conversion to an RValue _can_ be requested, but we just ignore it.
1 parent 4b483ec commit a2535a5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clang/lib/AST/Interp/EvalEmitter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ template <> bool EvalEmitter::emitRet<PT_FnPtr>(const SourceInfo &Info) {
152152
if (!isActive())
153153
return true;
154154
// Function pointers cannot be converted to rvalues.
155-
assert(!ConvertResultToRValue);
156155
EvalResult.setFunctionPointer(S.Stk.pop<FunctionPointer>());
157156
return true;
158157
}

clang/test/AST/Interp/comma.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %clang_cc1 -fsyntax-only -verify %s
2+
// RUN: %clang_cc1 -fsyntax-only -verify %s -fexperimental-new-constant-interpreter
3+
// expected-no-diagnostics
4+
5+
// PR6076
6+
void f();
7+
void (&g)() = (void(), f);
8+
9+
int a[1];
10+
int (&b)[1] = (void(), a);

0 commit comments

Comments
 (0)