* [PATCH] PR c++/80990 use cv-qualifiers in class template argument deduction
@ 2017-06-06 19:07 Jonathan Wakely
2017-06-07 11:03 ` Nathan Sidwell
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2017-06-06 19:07 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
This fixes class template argument deduction so that cv-qualifiers are
not ignored.
Bootstrapped and tested powerpc64le-linux. OK for trunk?
PR c++/80990
* pt.c (do_class_deduction): Build qualified type.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1413 bytes --]
commit 1a81d74fa9cf32cb33580cc4a5e9a7c5868ce32b
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Jun 6 18:38:30 2017 +0100
PR c++/80990 use cv-qualifiers in class template argument deduction
gcc/cp:
PR c++/80990
* pt.c (do_class_deduction): Build qualified type.
gcc/testsuite:
PR c++/80990
* g++.dg/cpp1z/class-deduction39.C: New.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a04f2e0..ada94bd 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -25367,7 +25367,7 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags,
--cp_unevaluated_operand;
release_tree_vector (args);
- return TREE_TYPE (t);
+ return cp_build_qualified_type (TREE_TYPE (t), cp_type_quals (ptype));
}
/* Replace occurrences of 'auto' in TYPE with the appropriate type deduced
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction39.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction39.C
new file mode 100644
index 0000000..98a3664
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction39.C
@@ -0,0 +1,15 @@
+// { dg-options -std=c++1z }
+
+template <class T> struct A { };
+
+A<int> a;
+const A c = a;
+volatile A v = a;
+const volatile A cv = a;
+
+template <class,class> struct same;
+template <class T> struct same<T,T> {};
+
+same<decltype(c), const A<int>> s1;
+same<decltype(v), volatile A<int>> s2;
+same<decltype(cv), const volatile A<int>> s3;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PR c++/80990 use cv-qualifiers in class template argument deduction
2017-06-06 19:07 [PATCH] PR c++/80990 use cv-qualifiers in class template argument deduction Jonathan Wakely
@ 2017-06-07 11:03 ` Nathan Sidwell
0 siblings, 0 replies; 2+ messages in thread
From: Nathan Sidwell @ 2017-06-07 11:03 UTC (permalink / raw)
To: Jonathan Wakely, gcc-patches
On 06/06/2017 03:07 PM, Jonathan Wakely wrote:
> This fixes class template argument deduction so that cv-qualifiers are
> not ignored.
>
> Bootstrapped and tested powerpc64le-linux. OK for trunk?
>
> PR c++/80990
> * pt.c (do_class_deduction): Build qualified type.
ok
--
Nathan Sidwell
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-07 11:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-06 19:07 [PATCH] PR c++/80990 use cv-qualifiers in class template argument deduction Jonathan Wakely
2017-06-07 11:03 ` Nathan Sidwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).