diff options
author | Geoffrey Keating <geoffk@apple.com> | 2005-06-17 22:13:33 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2005-06-17 22:13:33 +0000 |
commit | fad86f7a9ee8cc7eb9f6d9ea817649de703d7f16 (patch) | |
tree | d27af87945c7239afe065cecf47605bbc659ff87 /gcc | |
parent | 9498a22f75b078e17591bb9fd2dd67c424e793a3 (diff) | |
download | gcc-fad86f7a9ee8cc7eb9f6d9ea817649de703d7f16.zip gcc-fad86f7a9ee8cc7eb9f6d9ea817649de703d7f16.tar.gz gcc-fad86f7a9ee8cc7eb9f6d9ea817649de703d7f16.tar.bz2 |
re PR c++/17413 (local classes as template argument)
2005-06-17 Geoffrey Keating <geoffk@apple.com>
PR c++/17413
* pt.c (type_unification_real): Apply template type deduction even
to procedure parameters that are not dependent on a template
parameter.
Index: testsuite/ChangeLog
2005-06-17 Geoffrey Keating <geoffk@apple.com>
PR c++/17413
* g++.dg/template/local5.C: New.
From-SVN: r101141
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/local5.C | 12 |
4 files changed, 29 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index af04741..3f795aa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2005-06-17 Geoffrey Keating <geoffk@apple.com> + + PR c++/17413 + * pt.c (type_unification_real): Apply template type deduction even + to procedure parameters that are not dependent on a template + parameter. + 2005-06-16 Nathan Sidwell <nathan@codesourcery.com> * rtti.c (get_tinfo_decl): Avoid caching tinfo_descs when it might diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f130859..e811201 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9366,17 +9366,12 @@ type_unification_real (tree tparms, else type = arg; - if (strict == DEDUCE_EXACT) - { - if (same_type_p (parm, type)) - continue; - } - else - /* It might work; we shouldn't check now, because we might - get into infinite recursion. Overload resolution will - handle it. */ + if (same_type_p (parm, type)) continue; - + if (strict != DEDUCE_EXACT + && can_convert_arg (parm, type, TYPE_P (arg) ? NULL_TREE : arg)) + continue; + return 1; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 68b98ff..321c87a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-06-17 Geoffrey Keating <geoffk@apple.com> + + PR c++/17413 + * g++.dg/template/local5.C: New. + 2005-06-17 Richard Henderson <rth@redhat.com> * gcc.dg/sync-2.c (do_qi): Cast negative results to char. diff --git a/gcc/testsuite/g++.dg/template/local5.C b/gcc/testsuite/g++.dg/template/local5.C new file mode 100644 index 0000000..705dca3 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/local5.C @@ -0,0 +1,12 @@ +struct Attribute { }; + +template <class T> bool operator == (const Attribute &attr, const T &value); + +enum { + anon = 123 +}; + +void test(int foo) +{ + if (foo == anon) ; /* { dg-bogus "anonymous type" } */ +} |