A linkage-specification is a name-declaration
and has a terminal extern
unevaluated-string name-declaration.
An export-declaration isn't a name-declaration,
but Clang accepts one after a linkage-specification.
GCC diagnoses it: https://compiler-explorer.com/z/nozWPbxbG.
But Clang accepts it with an unexpected result: https://compiler-explorer.com/z/eefn3sWMs.
Note that if the export
comes before the extern
, both accept.
GCC: https://compiler-explorer.com/z/Y3zn6EEKK.
Clang: https://compiler-explorer.com/z/zb5qhxYEa.
module;
#include <iostream>
export module module_utility;
extern "C" __attribute__ ((visibility ("default")))
export void utility() {
std::cout << "Hello from utility!" << std::endl;
}