Message ID | 87lie1vhti.fsf@redhat.com |
---|---|
State | New |
Headers | show |
On 11/16/2012 07:43 AM, Dodji Seketeli wrote: > So I guess that condition should be changed to TREE_CODE > (template_type) == ENUMERAL_TYPE, to specifically detect the member > enum of a class template case. Why does that help? What is template_type in the alias template case? Jason
Jason Merrill <jason@redhat.com> writes: > On 11/16/2012 07:43 AM, Dodji Seketeli wrote: >> So I guess that condition should be changed to TREE_CODE >> (template_type) == ENUMERAL_TYPE, to specifically detect the member >> enum of a class template case. > > Why does that help? What is template_type in the alias template case? template_type is the template_type_parm T, which new name is AddConst.
Ah, I see. OK. Jason
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3c9bb56..101b22d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7487,7 +7487,7 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, = tree_cons (arglist, t, DECL_TEMPLATE_INSTANTIATIONS (templ)); - if (TREE_CODE (t) == ENUMERAL_TYPE && !is_dependent_type) + if (TREE_CODE (template_type) == ENUMERAL_TYPE && !is_dependent_type) /* Now that the type has been registered on the instantiations list, we set up the enumerators. Because the enumeration constants may involve the enumeration type itself, we make diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-27.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-27.C new file mode 100644 index 0000000..91208ab --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-27.C @@ -0,0 +1,11 @@ +// Origin: PR c++/54875 +// { dg-do compile { target c++11 } } + +template<typename T> +using AddConst = T const; + +enum FwdEnum : int; + +int main() { + AddConst<FwdEnum> *ptr = nullptr; +}