https://bugs.llvm.org/show_bug.cgi?id=48173
Bug ID: 48173
Summary: Increment incorrectly allowed for bool in
requires-expressions
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangb...@nondot.org
Reporter: ca...@carter.net
CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk
Compiling this well-formed program:
template <class T>
concept can_increment = requires(T t) {
++t;
};
template <class T>
void f() {
static_assert(requires(T t) { ++t; }); // Incorrectly allowed
}
int main() {
f<bool>();
static_assert(!can_increment<bool>); // Incorrectly fails
bool b = false;
++b; // Correctly rejected
}
with "clang++ -std=c++2a" (https://godbolt.org/z/39xM1E) diagnoses:
<source>:14:5: error: static_assert failed due to requirement
'!can_increment<bool>'
static_assert(!can_increment<bool>); // Incorrectly fails
^ ~~~~~~~~~~~~~~~~~~~~
<source>:17:5: error: ISO C++17 does not allow incrementing expression of
type bool [-Wincrement-bool]
++b;
^ ~
The compiler knows that the language forbids increment of bools _outside_ a
requires-expression, but apparently not _within_ a requires-expression.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs