Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
module reachability examples
export module quux;
export struct quux{};
// bar.h
import quux
export module foo;
export struct foo{};
module A:C;
struct C {};
// header_unit.h
struct HU {};
#include "bar.h" // imports quux
export module A:B;
import foo;
import :C;
export module A;
export import :B; // does this import foo? quux? A:C?
import "header_unit.h;
export quux b; // legal? (is today (maybe), 1 makes it not)
export foo f; // legal? (is today, 2 make it not)
export C getC() { return {}; } // legal? (is today, 3 makes it not)
export HU hu;
import A; // A:C is not "necessarily reachable"
C names_c; // Clearly illegal
auto& c_ref = getC(); // Clearly legal
auto c_copy = getC(); // Should this be legal? (unspecified today, 4 makes it legal)
auto& hu_ref = hu; // Clearly legal
auto hu_copy = hu; // Should this be legal? (unspecified today, 4 makes it legal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment