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

            Bug ID: 87435
           Summary: "Duplicate const" warning NOT emitted from typedef in
                    -std=c90
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ndesaulniers at google dot com
  Target Milestone: ---

Forked from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80868.

Test case: https://godbolt.org/z/jjstcx

typedef const int t;
const t x;

It seems that for -std=c90 (non pedantic, non GNU), GCC does not warn for a
duplicate type specifier.  That seems to violate C90 6.5.3 constraints: "The
same type qualifier shall not appear more than once in the same specifier-list
or qualifier-list, either directly or via one or more typedefs."

I found this while trying to match GCC's behavior for warning about duplicate
type qualifiers from `typeof` expressions in Clang:
https://reviews.llvm.org/D52248#1243898

Reply via email to