Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Convert symbols to expression type, fixes #115
Browse files Browse the repository at this point in the history
  • Loading branch information
jpf91 committed Apr 15, 2014
1 parent dc22461 commit d1afed7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
2014-04-15 Johannes Pfau <johannespfau@gmail.com>

* d-lang.cc(d_handle_noclone_attribute): New function, required for
naked attribute.
* d-lang.cc(d_handle_noclone_attribute): New function to handle
noclone attribute. noclone is required by the naked attribute.
* d-elem.cc(SymbolExp::toElem): Convert symbols to the expression
type.

2014-04-13 Iain Buclaw <ibuclaw@gdcproject.org>

Expand Down
6 changes: 6 additions & 0 deletions gcc/d/d-elem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,12 @@ SymbolExp::toElem (IRState *irs)
if (decl_reference_p (var))
exp = indirect_ref (var->type->toCtype(), exp);

// The frontend sometimes emits different types for the expression and var.
// Convert to the expressions type, but don't convert FuncDeclaration as
// type->toCtype sometimes isn't the correct type for functions!
if (!var->type->equals (type) && !var->isFuncDeclaration())
exp = build1 (VIEW_CONVERT_EXPR, type->toCtype(), exp);

return exp;
}
else if (op == TOKsymoff)
Expand Down

0 comments on commit d1afed7

Please sign in to comment.