Commit f74dcfb7 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/24761 (templates and inline-asm and "+")

	PR c++/24761
	* pt.c (tsubst_copy_asm_operands): New function.
	(tsubst_expr) <case ASM_EXPR>: Use it.

	* g++.dg/template/asm1.C: New test.

From-SVN: r106831
parent 6375779a
2005-11-12 Jakub Jelinek <jakub@redhat.com>
PR c++/24761
* pt.c (tsubst_copy_asm_operands): New function.
(tsubst_expr) <case ASM_EXPR>: Use it.
2005-11-08 Jakub Jelinek <jakub@redhat.com>
PR c++/19450
......
......@@ -8136,6 +8136,39 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
}
}
/* Like tsubst_copy_and_build, but unshare TREE_LIST nodes. */
static tree
tsubst_copy_asm_operands (tree t, tree args, tsubst_flags_t complain,
tree in_decl)
{
#define RECUR(t) tsubst_copy_asm_operands (t, args, complain, in_decl)
tree purpose, value, chain;
if (t == NULL)
return t;
if (TREE_CODE (t) != TREE_LIST)
return tsubst_copy_and_build (t, args, complain, in_decl,
/*function_p=*/false);
if (t == void_list_node)
return t;
purpose = TREE_PURPOSE (t);
if (purpose)
purpose = RECUR (purpose);
value = TREE_VALUE (t);
if (value)
value = RECUR (value);
chain = TREE_CHAIN (t);
if (chain && chain != void_type_node)
chain = RECUR (chain);
return tree_cons (purpose, value, chain);
#undef RECUR
}
/* Like tsubst_copy for expressions, etc. but also does semantic
processing. */
......@@ -8353,9 +8386,9 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
tmp = finish_asm_stmt
(ASM_VOLATILE_P (t),
tsubst_expr (ASM_STRING (t), args, complain, in_decl),
tsubst_expr (ASM_OUTPUTS (t), args, complain, in_decl),
tsubst_expr (ASM_INPUTS (t), args, complain, in_decl),
tsubst_expr (ASM_CLOBBERS (t), args, complain, in_decl));
tsubst_copy_asm_operands (ASM_OUTPUTS (t), args, complain, in_decl),
tsubst_copy_asm_operands (ASM_INPUTS (t), args, complain, in_decl),
tsubst_copy_asm_operands (ASM_CLOBBERS (t), args, complain, in_decl));
{
tree asm_expr = tmp;
if (TREE_CODE (asm_expr) == CLEANUP_POINT_EXPR)
......
2005-11-12 Jakub Jelinek <jakub@redhat.com>
PR c++/24761
* g++.dg/template/asm1.C: New test.
2005-11-12 Steven G. Kargl <kargls@comcast.net>
PR libgfortran/24787
// PR c++/24761
// { dg-do compile }
template <int>
int f (int i)
{
asm ("# %0 %1" : "+r" (i));
return i;
}
int main ()
{
return f<0> (0) + f<1> (0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment