Skip to content

Clang does not accept consteval operators #62886

Closed
@usx95

Description

@usx95

GCC: g++.dg/cpp2a/consteval31.C

struct A {
    consteval A operator+() { return {}; }
};
consteval A operator~(A) { return {}; }
consteval A operator+(A, A) { return {}; }

template <class> void f() {
    A a;
    A b = ~a; // cannot take address of consteval function 'operator~' outside of an immediate invocation
    A c = a + a; // similar error
    A d = +a; // similar error
}
template void f<int>();

https://godbolt.org/z/MxncM3Yaq
Looks important to fix and a possible blocker to #57094

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions