Bug 43145 - local extern declaration gets wrong namespace
Summary: local extern declaration gets wrong namespace
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Jason Merrill
URL:
Keywords: patch, wrong-code
Depends on:
Blocks: 4.6
  Show dependency treegraph
 
Reported: 2010-02-22 20:48 UTC by Jason Merrill
Modified: 2010-05-04 04:51 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-02-22 20:50:04


Attachments
patch for 4.6 (1.11 KB, patch)
2010-02-22 20:49 UTC, Jason Merrill
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Merrill 2010-02-22 20:48:56 UTC
For this testcase:

namespace N {
  void f();
}

void N::f()
{
  extern int i;
  extern void g();
  i = 1;
  g();
}

namespace N {
  int i;
  void g() { }
}

int main() { }

we end up with unsatisfied references to ::i and ::g.
Comment 1 Jason Merrill 2010-02-22 20:49:46 UTC
Created attachment 19937 [details]
patch for 4.6
Comment 2 Andrew Pinski 2010-03-13 01:29:16 UTC
If f is done inside "namespace N{}", it works
Comment 3 Jason Merrill 2010-05-04 04:51:21 UTC
Fixed for 4.6.