Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.old-deja / g++.law / visibility17.C
blob67ef8927a634dd1f5f9e289f1c7edbd1f97ed3f2
1 // { dg-do assemble  }
2 // GROUPS passed visibility
3 // visibility file
4 // From: Sandeep Shroff <ss@caere.com>
5 // Date:     Thu, 05 Aug 1993 17:23:20 -0700
6 // Subject:  Access to private constructor.
7 // Message-ID: <9308060023.AA10283@neptune.caere.com>
8 #include <iostream>
9 #include <cstring>
11 class Base
13 public:
14   char* getName() {return name_;}
16 private:
17   Base();
18   Base(char* str);
20   char* name_;
23 class Derived : public Base
25 public:
26   Derived(int n, char* str);
27   Derived(int n);
29   int getNum() {return num_;}
30 private:
31   int num_;
34 Base::Base() // { dg-error "is private" }
36   name_ = std::strcpy(new char[std::strlen(" ") + 1], " ");
39 Base::Base(char* str) // { dg-error "is private" }
41   if(str != NULL)
42     name_ = std::strcpy(new char[std::strlen(str) + 1], str);
45 Derived::Derived(int n, char* str) : Base(str) // { dg-error "within this context" }
47   num_ = n;
50 Derived::Derived(int n) : Base() // { dg-error "within this context" }
52   num_ = n;
57 int main()
59   // Derived* d = new Derived(10, "test");
60   Derived* d = new Derived(10);
62   std::cerr << d->getNum() << "\t" << d->getName() << std::endl;