[cfe-dev] overloadable + C string literal looks like a bug, seeking confirmation

Aaron Ballman via cfe-dev cfe-dev at lists.llvm.org
Fri Apr 16 05:05:51 PDT 2021


On Thu, Apr 15, 2021 at 6:10 PM Jon Chesterfield via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> Just opened https://bugs.llvm.org/show_bug.cgi?id=49978 with the default CC as I'm not sure who does C front end stuff. Seeking confirmation that this is considered a bug by other people.
>
> __attribute__((overloadable) void func(char *);
> __attribute__((overloadable) void func(const char *);
> void call(void)
> {
>   func("ambiguous");
> }
>
> I think "ambiguous" should decay to a char* and pick the char* overload. Something of an edge case because "literals" have different types between C and C++, and overloadable is an extension anyway.

FWIW, I think this is a bug. I think in C, this should pick the char *
overload because that's the type of the string literal.

~Aaron

>
> Thanks
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


More information about the cfe-dev mailing list