Opened 8 years ago
Last modified 7 years ago
#7 new defect
CFA Assertion Error: CodeGenerator visits TypeExpr in trait — at Initial Version
| Reported by: | ajbeach | Owned by: | |
|---|---|---|---|
| Priority: | minor | Component: | cfa-cc |
| Version: | 1.0 | Keywords: | |
| Cc: | a3moss |
Description
So I was trying to create a new stack with an implicate error handler and it still is not working. I am getting a failure in code generation. It appears to be trying to generate the code for the trait I created.
A trimmed down version of the code, which still generates the same error, is included:
#include <stdlib>
extern "C" {
#include <stdbool.h>
}
// (Bug 1 unresolved as of this test.)
forall(otype T)
struct stack_node;
forall(otype T)
struct stack_node {
stack_node(T) * next;
T item;
};
forall(otype T)
struct stack {
stack_node(T) * head;
};
trait stack_errors(otype T) {
T emptyStackHandler (stack(T) * this);
};
forall(otype T | stack_errors(T))
T pop (stack(T) * this) {
return (T){};
}
int emptyStackHandler (stack(int) * this) {
return 0;
}
int main (int argc, char * argv[]) {
stack(int) stackOfInts;
pop(&stackOfInts);
return 0;
}
I did a trace with gdb and it seems to be happening at line 22, which is the body of the trait stack_errors. Here is also a copy of the error message (minus stack trace).
*CFA assertion error* from program "cfa-cpp" in "virtual void CodeGen::CodeGenerator::visit(TypeExpr*)" at line 733 in file "CodeGen/CodeGenerator.cc": TypeExpr should not reach code generation.
Note:
See TracTickets
for help on using tickets.