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++ Patch] PR 51312


On 08/07/2014 06:49 AM, Paolo Carlini wrote:
+	  if (ENUM_UNDERLYING_TYPE (enumtype))
+	    value = perform_implicit_conversion_flags
+	      (ENUM_UNDERLYING_TYPE (enumtype), value, tf_warning_or_error,
+	       LOOKUP_IMPLICIT | LOOKUP_NO_NARROWING);

It seems like doing this unconditionally will suppress this error in some cases:

+	      if (!int_fits_type_p (value, ENUM_UNDERLYING_TYPE (enumtype)))
+		error ("enumerator value %E is outside the range of underlying "
+		       "type %<%T%>", value, ENUM_UNDERLYING_TYPE (enumtype));

Maybe only do the conversion above if the expression isn't already an integer or enumeration?

Jason


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