p4c
p4c copied to clipboard
Equal types are always equivalent
Signed-off-by: Mihai Budiu [email protected] Fixes #3699
Hmm, isn't the code in the testcase valid? Or is it just the way constant folding interacts with other passes that causes p4c to reject it too? At one point in the last 6 months, I remembered the testcase working fully too.
If the goal is simply to eliminate the CompilerBug, then it looks like this PR should do that.
@apinski-cavium Are you hoping for a change to the compiler that makes the added test program have no compile-time errors?
If the expression using the mux was used to initialize a const, then this could be a bug. As it is, I think it's an acceptable behavior of the compiler, although it's not the best user experience really.
@apinski-cavium what do you think, is this a legal behavior?
I think we should merge this anyway, and we can debate about the evaluation order later.