summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pubtypes.C
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/pubtypes.C
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/pubtypes.C')
-rw-r--r--gcc/testsuite/g++.dg/pubtypes.C65
1 files changed, 65 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/pubtypes.C b/gcc/testsuite/g++.dg/pubtypes.C
new file mode 100644
index 000000000..74bff595a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pubtypes.C
@@ -0,0 +1,65 @@
+/* Radar 4535968 */
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-O0 -gdwarf-2 -dA -fno-eliminate-unused-debug-types" } */
+/* { dg-final { scan-assembler "__debug_pubtypes" } } */
+/* { dg-final { scan-assembler "long+\[ \t\]+\(0x\)?\[0-9a-f]+\[ \t\n\]+\[#;@]+\[ \t\]+Length of Public Type Names Info" } } */
+/* { dg-final { scan-assembler "\"empty\\\\0\"+\[ \t\]+\[#;@]+\[ \t\]+external name" } } */
+/* { dg-final { scan-assembler "\"A\\\\0\"+\[ \t\]+\[#;@]+\[ \t\]+external name" } } */
+/* { dg-final { scan-assembler "\"B\\\\0\"+\[ \t\]+\[#;@]+\[ \t\]+external name" } } */
+
+
+struct A
+{
+ virtual ~A ();
+ int a1;
+};
+
+A::~A()
+{
+ a1 = 800;
+}
+
+struct B : public A
+{
+ virtual ~B ();
+ int b1;
+ int b2;
+};
+
+B::~B()
+{
+ a1 = 900;
+ b1 = 901;
+ b2 = 902;
+}
+
+// Stop the compiler from optimizing away data.
+void refer (A *)
+{
+ ;
+}
+
+struct empty {};
+
+// Stop the compiler from optimizing away data.
+void refer (empty *)
+{
+ ;
+}
+
+int main (void)
+{
+ A alpha, *aap, *abp;
+ B beta, *bbp;
+ empty e;
+
+ alpha.a1 = 100;
+ beta.a1 = 200; beta.b1 = 201; beta.b2 = 202;
+
+ aap = &alpha; refer (aap);
+ abp = &beta; refer (abp);
+ bbp = &beta; refer (bbp);
+ refer (&e);
+
+ return 0; // marker return 0
+} // marker close brace