Skip to content

[C++20] [Modules] Clang produce incorrect linkage if we export things in language linkage #76526

@JohelEGP

Description

@JohelEGP

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;
}

Metadata

Metadata

Assignees

Labels

clang:modulesC++20 modules and Clang Header ModulesinvalidResolved as invalid, i.e. not a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions