-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[analysis] Implement a Bool lattice #6036
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
}; | ||
|
||
#if __cplusplus >= 202002L | ||
static_assert(Lattice<Bool>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? Check it can instantiate the concept perhaps? (I just made that up as my best guess, I have no idea how concepts work... 😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concepts are named collections of type constraints, so this checks that the Bool
type satisfies the Lattice
constraints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks. So this is the same as Lattice<Bool> _unused;
basically, but without declaring a variable, and just asserting in debug builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately you cannot write Lattice<Bool> _unused
because concepts are not types, they're just predicates on types. Since this is a static_assert
, it is evaluated at compile time for all C++20 builds, not just debug builds.
This is a lattice with two elements: `false` is bottom and `true` is top. Add a new gtest file for testing lattices.
This is a lattice with two elements: `false` is bottom and `true` is top. Add a new gtest file for testing lattices.
This is a lattice with two elements:
false
is bottom andtrue
is top.Add a new gtest file for testing lattices.