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] Fix 66243, silent cast of scoped enum


On 05/25/2015 04:14 PM, Nathan Sidwell wrote:
On 05/25/15 15:43, Jason Merrill wrote:
On 05/24/2015 07:20 PM, Nathan Sidwell wrote:
-      else if (! INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value)))
+      else if (! INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P
+           (TREE_TYPE (value)))
         value = perform_implicit_conversion_flags
           (ENUM_UNDERLYING_TYPE (enumtype), value, tf_warning_or_error,
            LOOKUP_IMPLICIT | LOOKUP_NO_NARROWING);

The change is fine, but I wonder why perform_implicit_conversion_flags
was
succeeding?  I would think it should fail.

It wasn't being executed.  The if condition is if *NOT*
integral-or-enum.   The patch changes the check such that p_i_c_f is now
executed for scoped enums  -- and emits an appropriate error.

Ah, of course, thanks.

Jason



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