Commit 9d84dbe6 by Jason Merrill Committed by Jason Merrill

re PR c++/45012 (Invalid ambiguity on partial class specialization matching)

	PR c++/45102
	* pt.c (tsubst_copy_and_build) [CONST_DECL]: Don't pull out
	constant value if we're still in a template.

From-SVN: r179230
parent 69d28b4f
2011-09-26 Jason Merrill <jason@redhat.com>
PR c++/45102
* pt.c (tsubst_copy_and_build) [CONST_DECL]: Don't pull out
constant value if we're still in a template.
PR c++/46105
* typeck.c (structural_comptypes): Ignore cv-quals on typename scope.
......
......@@ -13916,7 +13916,7 @@ tsubst_copy_and_build (tree t,
t = tsubst_copy (t, args, complain, in_decl);
/* As in finish_id_expression, we resolve enumeration constants
to their underlying values. */
if (TREE_CODE (t) == CONST_DECL)
if (TREE_CODE (t) == CONST_DECL && !processing_template_decl)
{
used_types_insert (TREE_TYPE (t));
return DECL_INITIAL (t);
......
2011-09-26 Jason Merrill <jason@redhat.com>
PR c++/45012
* g++.dg/template/partial13.C: New.
PR c++/46105
* g++.dg/template/partial12.C: New.
......
// PR c++/45012
template <bool B, class T=void> struct enable_if;
template <class T>
struct enable_if<true,T>
{
typedef T type;
};
enum { RUNTIME = 0 };
// it compiles with the previous line commented out and the next commented in
// static const int RUNTIME=0;
template <class T, class U, class EN=void> struct foo;
template <template<int> class V, int M>
struct foo<V<M>,V<M>, typename enable_if<M==RUNTIME||M==2>::type> {};
template <template<int> class V1, template<int> class V2, int M>
struct foo<V1<M>,V2<M>, typename enable_if<M==RUNTIME||M==2>::type> {};
template <int M> struct bar {};
foo<bar<2>,bar<2> > x;
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