mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-26 04:14:06 +08:00
re PR c++/14429 (valid template template argument rejected)
PR c++/14429 * pt.c (coerce_template_template_parms) <PARM_DECL case>: Only check when the type of ARG is not dependent. * g++.dg/template/ttp11.C: New test. From-SVN: r85222
This commit is contained in:
parent
18d7916e39
commit
00bdb87f8e
@ -1,3 +1,9 @@
|
||||
2004-07-27 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/14429
|
||||
* pt.c (coerce_template_template_parms) <PARM_DECL case>: Only check
|
||||
when the type of ARG is not dependent.
|
||||
|
||||
2004-07-26 Geoffrey Keating <geoffk@apple.com>
|
||||
|
||||
* g++spec.c (LIBSTDCXX_PROFILE): Default to LIBSTDCXX.
|
||||
|
13
gcc/cp/pt.c
13
gcc/cp/pt.c
@ -3639,11 +3639,16 @@ coerce_template_template_parms (tree parm_parms,
|
||||
|
||||
case PARM_DECL:
|
||||
/* The tsubst call is used to handle cases such as
|
||||
template <class T, template <T> class TT> class D;
|
||||
|
||||
template <int> class C {};
|
||||
template <class T, template <T> class TT> class D {};
|
||||
D<int, C> d;
|
||||
|
||||
i.e. the parameter list of TT depends on earlier parameters. */
|
||||
if (!same_type_p
|
||||
(tsubst (TREE_TYPE (parm), outer_args, complain, in_decl),
|
||||
TREE_TYPE (arg)))
|
||||
if (!dependent_type_p (TREE_TYPE (arg))
|
||||
&& !same_type_p
|
||||
(tsubst (TREE_TYPE (parm), outer_args, complain, in_decl),
|
||||
TREE_TYPE (arg)))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-07-27 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/14429
|
||||
* g++.dg/template/ttp11.C: New test.
|
||||
|
||||
2004-07-27 Diego Novillo <dnovillo@redhat.com>
|
||||
|
||||
* gcc.c-torture/compile/20040727-1.c: New test.
|
||||
|
14
gcc/testsuite/g++.dg/template/ttp11.C
Normal file
14
gcc/testsuite/g++.dg/template/ttp11.C
Normal file
@ -0,0 +1,14 @@
|
||||
// { dg-do compile }
|
||||
|
||||
// Origin: heinlein@informatik.uni-ulm.de
|
||||
|
||||
// PR c++/14429: Matching of template template parameter containing
|
||||
// non-type parameter with type that depends on earlier parameter.
|
||||
|
||||
template <template <typename U, U* p> class T>
|
||||
struct X {};
|
||||
|
||||
template <template <typename U, U* p> class T>
|
||||
struct Y {
|
||||
X<T> x;
|
||||
};
|
19
gcc/testsuite/g++.dg/template/ttp12.C
Normal file
19
gcc/testsuite/g++.dg/template/ttp12.C
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2004 Free Software Foundation
|
||||
// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
// { dg-do compile }
|
||||
|
||||
// Check the type of non-type parameter in template template parameter
|
||||
// only if it is dependent.
|
||||
|
||||
template <template <int* p> class T>
|
||||
struct X {};
|
||||
|
||||
template <typename U, template <U* p> class T>
|
||||
struct Y {
|
||||
X<T> x;
|
||||
};
|
||||
|
||||
template <int* p> struct Z {};
|
||||
|
||||
Y<int, Z> y1;
|
||||
Y<char, Z> y2; // { dg-error "mismatch|expected|invalid" }
|
Loading…
Reference in New Issue
Block a user