aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2001-02-12 14:38:25 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2001-02-12 14:38:25 +0000
commit996065b44049d0e525f3e28794868fdaee722f3f (patch)
tree806c29a28bcde61c0db22d050ead14290a63b70a /gcc
parent82c18d5c67b2d121e8ef05c909f3e442c2ea742e (diff)
downloadgcc-996065b44049d0e525f3e28794868fdaee722f3f.zip
gcc-996065b44049d0e525f3e28794868fdaee722f3f.tar.gz
gcc-996065b44049d0e525f3e28794868fdaee722f3f.tar.bz2
pt.c (maybe_adjust_types_for_deduction, [...]): Remove spurious information in comment.
cp: * pt.c (maybe_adjust_types_for_deduction, DEDUCE_ORDER case): Remove spurious information in comment. Allow further adjustments of REFERENCE_TYPE args. testsuite: * g++.old-deja/g++.pt/spec40.C: New test. From-SVN: r39604
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c22
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec40.C13
4 files changed, 27 insertions, 18 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3f7b392..d1685b3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
+ * pt.c (maybe_adjust_types_for_deduction, DEDUCE_ORDER case):
+ Remove spurious information in comment. Allow further
+ adjustments of REFERENCE_TYPE args.
+
+2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
+
* errfn.c (cp_deprecated): Tweak diagnostic text.
* parse.y (new_initializer): Deprecate initializer lists
extension.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index aa77e63..bad8117 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7833,31 +7833,18 @@ maybe_adjust_types_for_deduction (strict, parm, arg)
compiler accepts it).
John also confirms that deduction should proceed as in a function
- call. Which implies the usual ARG and PARM bashing as DEDUCE_CALL.
+ call. Which implies the usual ARG and PARM conversions as DEDUCE_CALL.
However, in ordering, ARG can have REFERENCE_TYPE, but no argument
to an actual call can have such a type.
- When deducing against a REFERENCE_TYPE, we can either not change
- PARM's type, or we can change ARG's type too. The latter, though
- seemingly more safe, turns out to give the following quirk. Consider
- deducing a call to a `const int *' with the following template
- function parameters
- #1; T const *const & ; T = int
- #2; T *const & ; T = const int
- #3; T * ; T = const int
- It looks like #1 is the more specialized. Taken pairwise, #1 is
- more specialized than #2 and #2 is more specialized than #3, yet
- there is no ordering between #1 and #3.
-
- So, if ARG is a reference, we look though it when PARM is
- not a refence. When both are references we don't change either. */
+ If both ARG and PARM are REFERENCE_TYPE, we change neither.
+ If only ARG is a REFERENCE_TYPE, we look through that and then
+ proceed as with DEDUCE_CALL (which could further convert it). */
if (TREE_CODE (*arg) == REFERENCE_TYPE)
{
if (TREE_CODE (*parm) == REFERENCE_TYPE)
return 0;
*arg = TREE_TYPE (*arg);
- result |= UNIFY_ALLOW_OUTER_LESS_CV_QUAL;
- goto skip_arg;
}
break;
default:
@@ -7890,7 +7877,6 @@ maybe_adjust_types_for_deduction (strict, parm, arg)
*arg = TYPE_MAIN_VARIANT (*arg);
}
- skip_arg:;
/* [temp.deduct.call]
If P is a cv-qualified type, the top level cv-qualifiers
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index de55bb3..4607aa8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
+ * g++.old-deja/g++.pt/spec40.C: New test.
+
+2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
+
* g++.old-deja/g++.robertl/eb63.C: Remove new initializer list
case.
* g++.old-deja/g++.ext/arrnew.C: Deprecate.
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec40.C b/gcc/testsuite/g++.old-deja/g++.pt/spec40.C
new file mode 100644
index 0000000..2d0ad90
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec40.C
@@ -0,0 +1,13 @@
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 12 Feb 2001 <nathan@codesourcery.com>
+
+// More from bug 1617. We didn't resolve partial ordering properly. The
+// std is rather vague about it anyway, DR 214 talks about this.
+
+template <typename T> int Foo (T const *) {return 1;}
+template <unsigned I> int Foo (char const (&)[I]) {return 2;}
+
+int main ()
+{
+ return Foo ("a") != 2;
+}