re PR c++/23839 (ICE: expected var_decl, have parm_decl in cxx_mark_addressable, at cp/typeck.c:4343)

PR c++/23839
	* typeck.c (cxx_mark_addressable): Only check DECL_HARD_REGISTER
	for VAR_DECLs.

	PR c++/23839
	* g++.dg/parse/register1.C: New test.

From-SVN: r104225
This commit is contained in:
Mark Mitchell 2005-09-13 14:45:13 +00:00 committed by Mark Mitchell
parent 6493555fd3
commit 7b09c6a499
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2005-09-13 Mark Mitchell <mark@codesourcery.com>
PR c++/23839
* typeck.c (cxx_mark_addressable): Only check DECL_HARD_REGISTER
for VAR_DECLs.
2005-09-13 Mark Mitchell <mark@codesourcery.com>
PR c++/23842

View File

@ -4340,7 +4340,7 @@ cxx_mark_addressable (tree exp)
if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
&& !DECL_ARTIFICIAL (x))
{
if (DECL_HARD_REGISTER (x) != 0)
if (TREE_CODE (x) == VAR_DECL && DECL_HARD_REGISTER (x))
{
error
("address of explicit register variable %qD requested", x);

View File

@ -1,3 +1,8 @@
2005-09-13 Mark Mitchell <mark@codesourcery.com>
PR c++/23839
* g++.dg/parse/register1.C: New test.
2005-09-13 Mark Mitchell <mark@codesourcery.com>
PR c++/23842

View File

@ -0,0 +1,14 @@
// PR c++/23839
class C
{
int i;
public:
C(int j) : i(j) { }
operator int() { return i; }
};
C f (register C x)
{
return x + 31;
}