Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@cxx macro confusing parses #446

Open
goretkin opened this issue Nov 12, 2019 · 0 comments
Open

@cxx macro confusing parses #446

goretkin opened this issue Nov 12, 2019 · 0 comments

Comments

@goretkin
Copy link
Contributor

julia> (@cxx fabs(2.0);)
2.0

julia> (@cxx fabs(2.0);) == 2.0
true

julia> @cxx fabs(2.0) == 2.0;
ERROR: UndefVarError: fabs not defined
Stacktrace:
 [1] top-level scope at REPL[10]:1

julia> @cxx (fabs(2.0) == 2.0;)
ERROR: LoadError: Unrecognized CPP Expression begin
    fabs(2.0) == 2.0
end (block)
Stacktrace:
 [1] error(::String, ::Expr, ::String, ::Symbol, ::String) at ./error.jl:42
 [2] cpps_impl(::Module, ::Expr, ::Expr, ::Bool, ::Bool, ::Bool) at /Users/goretkin/.julia/dev/Cxx/src/cxxmacro.jl:175
 [3] cpps_impl(::Module, ::Expr) at /Users/goretkin/.julia/dev/Cxx/src/cxxmacro.jl:136
 [4] @cxx(::LineNumberNode, ::Module, ::Any) at /Users/goretkin/.julia/dev/Cxx/src/cxxmacro.jl:200
in expression starting at REPL[11]:1

I'm not sure why the last one doesn't return "true", but I don't understand fully the different scopes in C++.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant