[ About language linkage being part of function types…]
I hope someone who maintains an implementation for such a target will speak up. (I think someone did when this was last asked, though, so I don't think this is a theoretical or legacy concern. I'd be very happy to be wrong about that.)
Our front end can be configured in this respect:
- Whether C and C++ language linkage function types are distinct
- If they are not distinct, whether they can be implicitly converted from one to another
(and some added configurability to decide whether those implicit conversions are
enabled by default or require a command-line option)
For those customers who have shared they configurations with us, most appear to keep the types distinct but allow implicit conversions between them. So the following example is accepted:
extern "C" typedef int F(void);
extern "C++" typedef int FPP(void);
constexpr int g(F) { return 1; }
constexpr int g(FPP) { return 2; };
static_assert(g(f) == 1);
static_assert(g(fpp) == 2);
(The “major” implementations would complain g has a duplicate definition.)
Daveed