g++ needs to conform to a system's conventions in order to be usable on
a system.
However it can accept code that the system compiler doesn't accept, e.g.
(*[]( int x ) -> int { return x; });
Disclaimer: I didn't try this now, but with Visual C++ I would expect an
error because last I time I did something like that it complained about
the calling convention wrappers it itself generated resulting in
ambiguous overload resolution.
- - -
The formal is a very different kettle of fish.
There the question is whether a pointer to function with C++ calling
convention (the default, or `extern "C++") converts implicitly to
pointer to ditto function with C calling convention, `extern "C"`. In
practice it does, of course; that interoparbility and ability to
leverage C libraries was a main design goal. But as far as I know the
formal standard does not in any place permit that.
However, also as far as I know only a Solaris compiler has ever
complained by default, and then as a warning.
- Alf