https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110798

--- Comment #5 from miles <13958014620 at 139 dot com> ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to Andrew Pinski from comment #1)
> > I almost positive this was fixed by r14-159-g03cebd304955a6 which was
> > backported to GCC 13 branch r13-7277-ga713aa4f47ac1e (for 13.2.0) .
> 
> Yes, bisection confirms it. So this is a dup.
> 
> Aside: I'm not sure I'd call this a wrong-code bug. The testcase would be
> simpler if it used static_assert instead of assert, which would make it
> accepts-invalid / rejects-valid instead.
> 
> *** This bug has been marked as a duplicate of bug 108099 ***


> Aside: I'm not sure I'd call this a wrong-code bug.
Yep, the "unsigned" keyword qualifies an typedef-ed type is illegal according
to ISO_14882. It's acceptable that the compiler reports a failure, at least a
warning.

>The testcase would be simpler if it used static_assert instead of assert, 
>which would make itaccepts-invalid / rejects-valid instead.
Thanks a lot for your suggestion!

The experience of discovering this issue is very interesting.
I wrote a macro function to show the attributes of fundamental type for my son,
he's currently learning c++ language.

#define PRINT_TYPE_ATTRIBUTES(T)  \
    cout << "typeid(" << O_YELLOW(#T) << ").name(): " <<
O_RED(typeid(T).name()) <<endl \
    << "    demangling name: " << O_GREEN(abi::__cxa_demangle(typeid(T).name(),
0, 0, &status))<< endl \
    << "    sizeof(" << #T << "): " << O_BLUE(sizeof(T) << " bytes")<< endl \
    << "    sizeof( unsigned " << #T << "): " << O_BLUE(sizeof(unsigned T) << "
bytes")<< endl;

PRINT_TYPE_ATTRIBUTES(char);
PRINT_TYPE_ATTRIBUTES(int);
PRINT_TYPE_ATTRIBUTES(long);

these statements worked correctly;

my son puts uint8_t and uint64_t into the macro function. At first I thought he
would make a mistake ,but the compiler passed and the results are both 4. It's
confusing to us. I don't know how to explain to him at that time.

That's the whole story :)

Reply via email to