'pragma weak' redeclaration as extern function

Hello,

GCC 4.7.2 compiles the following program:

extern int PFoo(int);
#pragma weak PFoo = Foo
int Foo(int a) { return a; }
int main() {
  return PFoo(1);
}

while Clang emits an error:

$ clang weak.c
weak.c:5:8: error: call to 'PFoo' is ambiguous
return PFoo(1);
       ^~~~
weak.c:1:12: note: candidate function
extern int PFoo(int);
           ^
weak.c:2:14: note: candidate function
#pragma weak PFoo = Foo
             ^
1 error generated.

Is this an error on Clang's side?

Dmitri

Hello,

GCC 4.7.2 compiles the following program:

extern int PFoo(int);
#pragma weak PFoo = Foo
int Foo(int a) { return a; }
int main() {
  return PFoo(1);
}

while Clang emits an error:

+ Eli Friedman, who committed initial support for pragma weak and commented:
http://llvm.org/bugs/show_bug.cgi?id=3679#c16

Looks like it, yes. Would you mind reporting it in llvm.org/bugs?

Thanks,
Rafael

Thanks for looking. http://llvm.org/bugs/show_bug.cgi?id=15695

Dmitri