On Tue, 4 Apr 2017 23:28:09 +0100 Jonathan Wakely <gt...@kayari.org> wrote: > On 4 April 2017 at 23:08, Chris Vine wrote: [snip] > > It also seems > > weird that merely applying -std=c++17 to your code should break its > > ABI. The more I think about it, the less clear I am what making the > > noexcept specification part of the function type in C++17 actually > > involves compiler-wise, or what it achieves. > > It allows overloading on whether a function can throw, and > specializing templates on it, and deducing it from template arguments. > > So if you take the address of a function you don't lose it's > "noexceptiness". Previously this static assertion could never pass: > > void f() noexcept; > template<typename F> void g(F f) { > static_assert( noexcept( f() ), "callback won't throw" ); > } > > int main() { > g( &f ); > } > > In C++17 it compiles.
Aha, this may be it. http://en.cppreference.com/w/cpp/language/noexcept_spec also says: "Functions differing only in their exception specification cannot be overloaded (just like the return type, exception specification is part of function type, but not not part of the function signature) (since C++17)." So I suspect that the noexcept specification may still not affect name mangling. It might cause a compile error on type mismatch in C++17 when say assigning a function to a function pointer, and as you say it may allow the noexcept specification to participate in template type resolution, but it may not affect linkage. I hope so anyway. _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list