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

            Bug ID: 66935
           Summary: Compiler rejects well-formed program with local extern
                    variable declaration and using-declaration
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

The following program is well-formed. The two declarations in main are not
conflicting.

  int x = 1;

  int main() {
      extern int x;
      using ::x;
  }

The following output is given when compiling it:

  prog.cc: In function 'int main()':
  prog.cc:5:13: error: redeclaration of 'int x'
       using ::x;
               ^
  prog.cc:4:16: note: previous declaration 'int x'
       extern int x;
                  ^

Expected behaviour is to get no error messages.

Reply via email to