This is an archive of the discontinued LLVM Phabricator instance.

Functions declared in a scope should not hide previous declaration in earlier scopes
ClosedPublic

Authored by ogoffart on Apr 30 2016, 4:42 AM.

Details

Summary

This code should be an error:

void foo(int); 
void f3() {
  int foo(float);
  {
    float foo(int); // expected-error {{functions that differ only in their return type cannot be overloaded}}
  }
}

the foo(float) function declared at function scope should not hide the float(int) while trying to redeclare functions.

Diff Detail

Event Timeline

ogoffart updated this revision to Diff 55712.Apr 30 2016, 4:42 AM
ogoffart retitled this revision from to Functions declared in a scope should not hide previous declaration in earlier scopes .
ogoffart updated this object.
ogoffart added reviewers: cfe-commits, rsmith.

Ping.
This would be required for http://reviews.llvm.org/D19764

rsmith accepted this revision.Jun 16 2016, 12:07 PM
rsmith edited edge metadata.
rsmith added inline comments.
lib/Sema/SemaLookup.cpp
1091

Please rename this to something like SearchNamespaceScope (and invert the sense of it) to reflect what it now means.

This revision is now accepted and ready to land.Jun 16 2016, 12:07 PM
This revision was automatically updated to reflect the committed changes.