From d8f02ae6281315989c06376e53620935d1359dec Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Wed, 2 Sep 1998 22:11:26 +0000 Subject: [PATCH] Test fuer SmartPointer git-svn-id: https://svn.dealii.org/trunk@548 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/Makefile | 33 +++++++++++++++++++++++++++++++++ tests/base/reference.cc | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 tests/base/Makefile create mode 100644 tests/base/reference.cc diff --git a/tests/base/Makefile b/tests/base/Makefile new file mode 100644 index 0000000000..3ab82b48d2 --- /dev/null +++ b/tests/base/Makefile @@ -0,0 +1,33 @@ +# $Id$ +# +# Set root directory of DEAL distribution. +# This is only one letter to make the rest MORE readable. + +D=../.. + +CXX = c++ +INCLUDE = -I$D/deal.II/include -I$D/lac/include \ + -I$D/base/include + +CXXFLAGS = -DDEBUG -g -Wall -W -pedantic -Wconversion \ + -Winline -Woverloaded-virtual -fno-rtti \ + $(INCLUDE) -Ddeal_II_dimension=$(deal_II_dimension) + +%.go : %.cc + @echo ============================ Compiling with debugging information: $< + @$(CXX) $(CXXFLAGS) -c $< -o $@ +%.o : %.cc + @echo ============================ Compiling with optimization: $< + @$(CXX) $(CXXFLAGS) -c $< -o $@ + + +vpath %.a: $D/base/lib +vpath %.a: $D/lac/lib +vpath %.a: $D/deal.II/lib + +ifeq ($(shell uname),Linux) +CXX = /home/wolf/bin/gcc/bin/c++ +endif + +reference: reference.go + $(CXX) -o $@ $^ \ No newline at end of file diff --git a/tests/base/reference.cc b/tests/base/reference.cc new file mode 100644 index 0000000000..03c69251ca --- /dev/null +++ b/tests/base/reference.cc @@ -0,0 +1,34 @@ + +#include +#include +#include + +class Test : public Subscriptor +{ +public: + void f() + { + cout << "mutable" << endl; + } + void f() const + { + cout << "const" << endl; + } +}; + +main() +{ + Test a; + const Test b; + SmartPointer r=&a; + const SmartPointer s=&a; + SmartPointer t=&b; + const SmartPointer u=&b; + + a.f(); + b.f(); + r->f(); + s->f(); + t->f(); + u->f(); +} -- 2.39.5