Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #60, cxx casts + test case
  • Loading branch information
lispbub committed Feb 6, 2017
1 parent 957a9e9 commit ebe664d
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 6 deletions.
4 changes: 2 additions & 2 deletions INSTALL
Expand Up @@ -12,8 +12,8 @@ without warranty of any kind.
Basic Installation
==================

Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
Briefly, the shell command `./configure && make && make install'
should configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
Expand Down
3 changes: 2 additions & 1 deletion Makefile.am
Expand Up @@ -24,7 +24,8 @@ cm_cxx_SOURCES = src/cxx/nodes.lisp \
src/cxx/syntax.lisp \
src/cxx/pretty.lisp \
src/cxx/reader.lisp \
src/cxx/cm-cxx.lisp
src/cxx/cm-cxx.lisp \
src/cxx/cmu-cxx.lisp

cm_glsl_SOURCES = src/glsl/nodes.lisp \
src/glsl/syntax.lisp \
Expand Down
7 changes: 5 additions & 2 deletions c-mera.asd
Expand Up @@ -152,14 +152,16 @@
(append c-symbols
'(delete decl)))

;; symbols not shadowed but expoted
;; symbols not shadowed but exported
(defparameter c++syntax
(append c-syntax
'(class vector new constructor
private public protected
namespace using reference-type
using-namespace from-namespace
template instantiate)))
template instantiate
dynamic-cast static-cast
reinterpret-cast const-cast)))

(defparameter c++exports
(append default-exports
Expand Down Expand Up @@ -529,6 +531,7 @@
(asdf:defsystem cmu-c++
:name "c-mera user c++"
:version "0.0.2"
:components ((:file "src/cxx/cmu-cxx"))
:depends-on ("c-mera"
"cm-c"
"cmu-c"
Expand Down
2 changes: 1 addition & 1 deletion tests/Makefile
Expand Up @@ -38,7 +38,7 @@ cxx-decl-tests-pre:
@echo "- Declarations:"
cxx-decl-tests: cxx-decl-tests-pre $(cxx-decl-results)

cxx-misc-test-files = $(shell ls cxx.stmt-expr.*.lisp)
cxx-misc-test-files = $(shell ls cxx.misc.*.lisp)
cxx-misc-results = $(cxx-misc-test-files:%.lisp=%.ok)
cxx-misc-tests-pre:
@echo "- Misc:"
Expand Down
27 changes: 27 additions & 0 deletions tests/cxx.misc.cast.00.lisp
@@ -0,0 +1,27 @@
(include <iostream>)
(include <typeinfo>)
(using-namespace std)

(class A ()
(decl ((int a))))

(class B ((public A))
(decl ((int b))))

(function main () -> int
(decl ((int foo = 0)
(const int* bar = (const-cast const int* &foo))
(float foo2 = 3.14)
(B* foo3 = (new B))
(A* foo4 = (dynamic-cast A* foo3)))
(set (dref (const-cast int* bar)) 1)
(<< cout foo endl)
(<< cout (static-cast int foo2) endl)
(<< cout (oref (typeid foo3) (name)) endl)
(<< cout (oref (typeid foo4) (name)) endl)
(return 0)))

;;## 1
;;## 3
;;## P1B
;;## P1A
File renamed without changes.

0 comments on commit ebe664d

Please sign in to comment.