Typedecl::membership() should be optional because of 'local classes'
Closed this issue · 4 comments
d-winsor commented
Typedecl will not have a membership if it is declared locally in a function.
int foo()
{
struct Local { int x; };
}
GabrielDosReis commented
It should instead return a const Expr&
instead of const Type&
: in the above case we want to designate foo
as its owner, or the nested block if the definition appears in deeper. Alternatively, it could just systematically return const Region&
.
d-winsor commented
Would the owner be ipr::Fundecl (foo) or the ipr::Block. Consider the case below:
void foo()
{
{
struct SameName{ int blue; };
}
{
struct SameName{ int red; };
}
}
GabrielDosReis commented
Yes, that is exactly why I suggested foo
, or the enclosing block if nested. foo
is for the case where it is the outermost compound statement that makes up the body of the function -- so no indirection is needed to find the function that owns the block that owns the type.
d-winsor commented
Sorry I just miss read your reply,