This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Sun, 2007-03-11 at 17:24 -0400, Jason Merrill wrote: > I think the boolean field is necessary, too, for distinguishing between > lvalue and rvalue types. But it can be internal to the front end, > perhaps using TYPE_LANG_FLAG_2.
I can switch to that flag, but the problem is that if you want to use _any_ flag to distinguish between REFERENCE_TYPE nodes, you have to modify the code which creates REFERENCE_TYPE nodes to check that flag. Otherwise, nodes which are supposed to have different flag values will wind up occupying the same spot on the TYPE_NEXT_REF_TO chain. There's no way to avoid modifying the middle end (even though those modifications can be done in a language-neutral way) if we want to keep on using REFERENCE_TYPE nodes to represent l-value and r-value references in the front end.
What if (a new) cp_build_reference_type keeps its own hash table of rvalue REFERENCE_TYPE references, but forwards to build_reference_type for lvalue references?
I still think Jason's trick might just work... the front end only builds REFERNCE_TYPEs with mode==ptr_mode. So cp_build_reference_type would always make sure to build the lvalue REFERENCE_TYPE (mode == ptr_mode) first, then put the rvalue REFERENCE_TYPE (also mode == ptr_mode) later in the list. The common build_reference_type_for_mode will always find the first (lvalue) reference type, whereas cp_build_reference_type knows better and will also use the appropriate TYPE_LANG_FLAG bit.
Cheers, Doug
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |