Commit r245829 (1st Mar 2017) was the first time a module interface, module implementation and main executable linked and ran successfully. It's kind of held together with gaffer tape and bailing twine thought
These are mod-impl-1_[a-d].C in the testsuite.
// interface module baz [[interface]]; export int Square (int); int Prod (int, int);
// implementation part-1
module baz;
int Square (int a)
{
return Prod (a, a);
}cc1plus -fmodules -std=c++1z
// implementation part-2
module baz;
// FIXME _MBaz gaffer tape
int _Mbaz::Prod (int a, int b)
{
return a * b;
}// main program
import baz;
int Prod (int a, int b)
{
return -a * b; // What kind of crazy math is this?
}
int Square (float a)
{
return Prod (int (a), int (a));
}
int main ()
{
if (Square (2) != 4)
return 1;
if (Square (2.0f) != -4)
return 1;
return 0;
}cc1plus -fmodules -std=c++1z mod-impl-1_a.C cc1plus -fmodules -std=c++1z mod-impl-1_b.C cc1plus -fmodules -std=c++1z mod-impl-1_c.C cc1plus -fmodules -std=c++1z mod-impl-1_d.C g++ mod-impl-1_[a-d].o ./a.out ; echo $?