mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-05 18:49:43 +08:00
decl.c (finish_enum): Don't resolve CONST_DECLs to their corresponding INTEGER_CSTs when...
* decl.c (finish_enum): Don't resolve CONST_DECLs to their corresponding INTEGER_CSTs when processing_template_decl. * pt.c (tsubst_enum): Tweak accordingly. From-SVN: r22211
This commit is contained in:
parent
a0d9f32252
commit
72f2bd784e
@ -1,3 +1,9 @@
|
||||
1998-09-03 Mark Mitchell <mark@markmitchell.com>
|
||||
|
||||
* decl.c (finish_enum): Don't resolve CONST_DECLs to their
|
||||
corresponding INTEGER_CSTs when processing_template_decl.
|
||||
* pt.c (tsubst_enum): Tweak accordingly.
|
||||
|
||||
1998-09-03 Benjamin Kosnik <bkoz@rhino.cygnus.com>
|
||||
|
||||
* decl.c (pushdecl_class_level): Add warning here.
|
||||
|
@ -11926,9 +11926,15 @@ finish_enum (enumtype)
|
||||
minnode = value;
|
||||
}
|
||||
|
||||
/* In the list we're building up, we want the enumeration
|
||||
values, not the CONST_DECLs. */
|
||||
TREE_VALUE (pair) = value;
|
||||
if (processing_template_decl)
|
||||
/* If this is just a template, leave the CONST_DECL
|
||||
alone. That way tsubst_copy will find CONST_DECLs for
|
||||
CONST_DECLs, and not INTEGER_CSTs. */
|
||||
;
|
||||
else
|
||||
/* In the list we're building up, we want the enumeration
|
||||
values, not the CONST_DECLs. */
|
||||
TREE_VALUE (pair) = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -8205,7 +8205,11 @@ tsubst_enum (tag, newtag, args)
|
||||
{
|
||||
tree elt
|
||||
= build_enumerator (TREE_PURPOSE (e),
|
||||
tsubst_expr (TREE_VALUE (e), args,
|
||||
/* Note that in a template enum, the
|
||||
TREE_VALUE is the CONST_DECL, not the
|
||||
corresponding INTEGER_CST. */
|
||||
tsubst_expr (DECL_INITIAL (TREE_VALUE (e)),
|
||||
args,
|
||||
NULL_TREE),
|
||||
newtag);
|
||||
|
||||
|
16
gcc/testsuite/g++.old-deja/g++.pt/enum12.C
Normal file
16
gcc/testsuite/g++.old-deja/g++.pt/enum12.C
Normal file
@ -0,0 +1,16 @@
|
||||
// Build don't link:
|
||||
|
||||
template <int I>
|
||||
struct S1 { };
|
||||
|
||||
template <class T>
|
||||
struct S2 {
|
||||
enum { x = 3 };
|
||||
|
||||
void f(S1<x>&);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void S2<T>::f(S1<x>&)
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user