Skip to content

Instantly share code, notes, and snippets.

@kevinushey
Last active February 9, 2020 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinushey/cfa848be2d39ddd110f893d9b6c5ac9c to your computer and use it in GitHub Desktop.
Save kevinushey/cfa848be2d39ddd110f893d9b6c5ac9c to your computer and use it in GitHub Desktop.
Fails to compile with gcc 10 on Fedora Rawhide.
void* callback(const char* name);
extern "C" {
inline void f1()
{
static void (*f)();
f = (void(*)()) callback("f1");
f();
}
inline void f2()
{
static void (*f)();
f = (void(*)()) callback("f2");
f();
}
} // extern "C"
int main()
{
f1();
f2();
}
@kevinushey
Copy link
Author

I've removed the implementation of callback() so at least this should no longer be UB. The underlying issue though is as @Enchufa2 says, with duplicate (and non-mangled) names for f generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment