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

C++ compilation error on a datatype with a type parameter #1294

Open
fpoli opened this issue Jul 13, 2021 · 0 comments
Open

C++ compilation error on a datatype with a type parameter #1294

fpoli opened this issue Jul 13, 2021 · 0 comments
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label lang: c++ Dafny's C++ transpiler and its runtime

Comments

@fpoli
Copy link
Contributor

fpoli commented Jul 13, 2021

The C++ code generated by the following program doesn't compile.

Command: dafny /compile:3 /spillTargetCode:2 /compileTarget:cpp Program.dfy

Program:

newtype nat32 = i:int | 0 <= i < 0x80000000

datatype PhantomData<T> = PhantomData(value: T)

method Main() {
    var x: nat32 := 123;
    var p := PhantomData(x);
}

Output:

Dafny program verifier finished with 2 verified, 0 errors
Wrote textual form of target program to Comp.cpp
Additional target code written to Comp.h
Comp.cpp:30:34: error: use of undeclared identifier 'T'
    _13_p = _module::PhantomData<T>(_12_x);
                                 ^
1 error generated.
Error while compiling C++ files. Process exited with exit code 1
@keyboardDrummer keyboardDrummer added kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label lang: c++ Dafny's C++ transpiler and its runtime labels Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label lang: c++ Dafny's C++ transpiler and its runtime
Projects
None yet
Development

No branches or pull requests

2 participants