Last active
July 18, 2017 14:58
-
-
Save benvanik/a38ae821d6ccfdb5b4a206d2ef11cf09 to your computer and use it in GitHub Desktop.
bzlrepro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "a.h" | |
A::A() = default; | |
A::~A() = default; | |
int A::QueryX() { return x; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef A_H_ | |
#define A_H_ | |
constexpr int kReallyX = 7; | |
class A { | |
public: | |
A(); | |
~A(); | |
int QueryX(); | |
int x = kReallyX; | |
}; | |
#endif // A_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "b.h" | |
B::B(A* a) : a(a) {} | |
B::~B() = default; | |
int B::QueryY() { return a->QueryX(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef B_H_ | |
#define B_H_ | |
#include "a.h" | |
class B { | |
public: | |
explicit B(A* a); | |
~B(); | |
int QueryY(); | |
A* a; | |
}; | |
#endif // B_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package(default_visibility = ["//visibility:public"]) | |
cc_library( | |
name = "a", | |
srcs = ["a.cc"], | |
hdrs = ["a.h"], | |
) | |
cc_library( | |
name = "b", | |
srcs = ["b.cc"], | |
hdrs = ["b.h"], | |
deps = [":a"], | |
) | |
cc_binary( | |
name = "c", | |
srcs = ["c.cc"], | |
deps = [":b"], | |
) | |
cc_binary( | |
name = "d", | |
srcs = ["d.cc"], | |
deps = [":b"], | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include "b.h" | |
int main() { | |
A a; | |
B b(&a); | |
printf("%d", b.QueryY()); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include "b.h" | |
int main() { | |
A a; | |
B b(&a); | |
printf("kReallyX = %d\n", kReallyX); | |
printf("B.QueryY() = %d\n", b.QueryY()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment