From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/g++.old-deja/g++.law/visibility17.C | 66 +++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.law/visibility17.C (limited to 'gcc/testsuite/g++.old-deja/g++.law/visibility17.C') diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility17.C b/gcc/testsuite/g++.old-deja/g++.law/visibility17.C new file mode 100644 index 000000000..67ef8927a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility17.C @@ -0,0 +1,66 @@ +// { dg-do assemble } +// GROUPS passed visibility +// visibility file +// From: Sandeep Shroff +// Date: Thu, 05 Aug 1993 17:23:20 -0700 +// Subject: Access to private constructor. +// Message-ID: <9308060023.AA10283@neptune.caere.com> +#include +#include + +class Base +{ +public: + char* getName() {return name_;} + +private: + Base(); + Base(char* str); + + char* name_; +}; + +class Derived : public Base +{ +public: + Derived(int n, char* str); + Derived(int n); + + int getNum() {return num_;} +private: + int num_; +}; + +Base::Base() // { dg-error "is private" } +{ + name_ = std::strcpy(new char[std::strlen(" ") + 1], " "); +} + +Base::Base(char* str) // { dg-error "is private" } +{ + if(str != NULL) + name_ = std::strcpy(new char[std::strlen(str) + 1], str); +} + +Derived::Derived(int n, char* str) : Base(str) // { dg-error "within this context" } +{ + num_ = n; +} + +Derived::Derived(int n) : Base() // { dg-error "within this context" } +{ + num_ = n; +} + + + +int main() +{ + // Derived* d = new Derived(10, "test"); + Derived* d = new Derived(10); + + std::cerr << d->getNum() << "\t" << d->getName() << std::endl; +} + + + -- cgit v1.2.3