[cfe-dev] Confusing "Only weak aliases are supported on darwin" error message.

Dan Liew via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 2 09:52:26 PST 2017


Hi,

I stumbled across a confusing error message that clang (3.9) gives
when it asked to compile this program

```
void g() {}
void f() __attribute__((weak, alias("g")));
```

Note this is a minor a variant of an existing test case [1].

When I try to compile the above program I see

```
clang -target x86_64-apple-darwin -emit-llvm -S attr-alias.c -o -
attr-alias.c:2:31: error: only weak aliases are supported on darwin
void f() __attribute__((weak, alias("g")));
                              ^
1 error generated.
```

This error message is really confusing to me. Surely f() is a weak
alias for g() because is has __attribute__((weak, alias("g")))) ?

CC'ing Rafael because it looks like r121137 is responsible for this.

[1] https://github.com/llvm-mirror/clang/blob/a0badfbffbee71c2c757d580fc852d2124dadc5a/test/Sema/attr-alias.c

Thanks,
Dan.



More information about the cfe-dev mailing list