This is the mail archive of the gcc-bugs@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]

[Bug c++/59980] Diagnostics relating to template-specialisations using enums.


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59980

--- Comment #3 from Jason <gcc-bugs at hussar dot demon.co.uk> ---
C-style enums decay to the underlying integer representation, this particular
behaviour helps complicate considering how any modification to the diagnostic
might be implemented. Enum-classes are not without their own set of
complications, 
but these are fewer than C-style enums, and might be more amenable to
implementing this modification of the diagnostic. As I see it the basic problem
is that the mapping of integers to sets-of-{of enumerator values} is not unique
for C-style enums. The issue is one of choice: (expression) can map to
{enumerator-names}, so which should one choose? But if one were to restrict
oneself to enum-classes, the mapping of (expression) to sets-of-{of enemerator
values} has been broken: one must explicitly cast, so at the cast-site the
particular enumeration is known, and if the results maps to an enumeration
value, it can be printed, otherwise the value could just be printed, with the
cast, as is done already. In particular, in my example of the
template-specialisation, the target enum-class is known, therefore the
diagnostic can reasonably coerce the result of the expression to a matching
enumeration-value, if it exists, and print that name. Of course one would need
to ensure that the enumerator-names have been stored with the enumerator-values
within the enumeration to allow this to occur.


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