Fix attributes of typed enums of typedefs
authorHannes Domani <ssbssa@yahoo.de>
Fri, 3 Apr 2020 19:38:31 +0000 (21:38 +0200)
committerHannes Domani <ssbssa@yahoo.de>
Fri, 3 Apr 2020 20:09:54 +0000 (22:09 +0200)
commit9e7c9a03eefafae549dafa8bec13232a780804ef
tree4e199f3c1b8691c463c67b509e2a492dc3b59894
parentd9e49b61691f384447242f54c996fe80ef9bf184
Fix attributes of typed enums of typedefs

For this enum:
typedef unsigned char byte;
enum byte_enum : byte
{
  byte_val = 128
};

The unsigned attribute is not set:
(gdb) p byte_val
$1 = -128

That's because it uses the attributes of the 'byte' typedef for the enum.
So this changes it to use the attributes of the underlying 'unsigned char'
instead.

gdb/ChangeLog:

2020-04-03  Hannes Domani  <ssbssa@yahoo.de>

PR gdb/25325
* dwarf2/read.c (read_enumeration_type): Fix typed enum attributes.

gdb/testsuite/ChangeLog:

2020-04-03  Hannes Domani  <ssbssa@yahoo.de>

PR gdb/25325
* gdb.cp/typed-enum.cc: New test.
* gdb.cp/typed-enum.exp: New file.
gdb/ChangeLog
gdb/dwarf2/read.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/typed-enum.cc [new file with mode: 0644]
gdb/testsuite/gdb.cp/typed-enum.exp [new file with mode: 0644]