As discussed in the LDWG in September 2025 (p4lang/p4c#5092 (comment)), for a declaration statement that uses a identifier of an outer scope as an initialiser for a new entity of the same name, such as:
bit<1> func(in bit<8> a, in bit<1> t) {
if (t == 1) {
bit <8> a = a;
:
}
:
}
Is this valid code, where the a used as an initialiser is that of the function declaration, or is this invalid because they refer to the same entity?
The P4 language specification does not state which scope is used for the evaluation of the initialiser and should be updated.
@jonathan-dilorenzo , @ChrisDodd , @KunJeong , @jaehyun1ee , @rcgoodfellow , @fruffy and @jafingerhut for visibility.
As discussed in the LDWG in September 2025 (p4lang/p4c#5092 (comment)), for a declaration statement that uses a identifier of an outer scope as an initialiser for a new entity of the same name, such as:
Is this valid code, where the a used as an initialiser is that of the function declaration, or is this invalid because they refer to the same entity?
The P4 language specification does not state which scope is used for the evaluation of the initialiser and should be updated.
@jonathan-dilorenzo , @ChrisDodd , @KunJeong , @jaehyun1ee , @rcgoodfellow , @fruffy and @jafingerhut for visibility.