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]

Re: [C++0x] implementing forward declarations for enums


On 09/26/2010 10:23 AM, Rodrigo Rivas wrote:
Most notably, I've moved the begin_scope()/end_scope() of scoped enums
into the parsing code. This way it is much easier to ensure that they
are balanced. I'm not sure if they are needed in the template
instantiation, but added it anyway, just in case.

They are needed.


I'm using the TYPE_LANG_FLAG_2 in order to check for the enumerator
lists, I don't know if this is appropriate.

That's fine.


One more question: scoped enumerations call maybe_warn_cpp0x() so they
are accepted in C++98 mode, but with a warning. Should forward
enumerations be accepted also? Currently, I'm accepting them only in
C++0x mode.

I don't have a strong preference unless libstdc++ really wants to use them. But rather than checking cxx_dialect with ==, compare it against cxx0x with < or >=.


+      /* If this enum has value list from a previous declaration, then it has already
+         been finished. Do not do it again.  */
+      must_finish = !ENUM_HAS_VALUE_LIST_P (type);

What if you get two opaque declarations in a row?


+      if (CLASS_TYPE_P (nested_name_specifier))
+	{
+	  nested_being_defined = TYPE_BEING_DEFINED (nested_name_specifier);
+	  TYPE_BEING_DEFINED (nested_name_specifier) = 1;
+	  push_scope (nested_name_specifier);
+	}

Hmm, this looks odd, but I guess it's necessary for adding enumerators to the class scope after the class is already complete.


Comments, testscases and changelog still missing.

Yep. :)


Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]