!53 [C++] Fix interaction between aka changes and DR1558 (PR92206)
From: @eastb233 Reviewed-by: @jdkboy Signed-off-by: @jdkboy
This commit is contained in:
commit
5a52860a71
98
Fix-interaction-between-aka-changes-and-DR1558.patch
Normal file
98
Fix-interaction-between-aka-changes-and-DR1558.patch
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
This backport contains 1 patch from gcc main stream tree.
|
||||||
|
The commit id of these patchs list as following in the order of time.
|
||||||
|
|
||||||
|
0001-Fix-interaction-between-aka-changes-and-DR1558.patch
|
||||||
|
ae83b9deb87787371cd94b4417e160d41dd0322c
|
||||||
|
|
||||||
|
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
|
||||||
|
index adc021b2a5c..42afe1bd5cb 100644
|
||||||
|
--- a/gcc/cp/cp-tree.h
|
||||||
|
+++ b/gcc/cp/cp-tree.h
|
||||||
|
@@ -5759,8 +5759,13 @@ enum auto_deduction_context
|
||||||
|
|
||||||
|
STF_USER_VISIBLE: use heuristics to try to avoid stripping user-facing
|
||||||
|
aliases of internal details. This is intended for diagnostics,
|
||||||
|
- where it should (for example) give more useful "aka" types. */
|
||||||
|
+ where it should (for example) give more useful "aka" types.
|
||||||
|
+
|
||||||
|
+ STF_STRIP_DEPENDENT: allow the stripping of aliases with dependent
|
||||||
|
+ template parameters, relying on code elsewhere to report any
|
||||||
|
+ appropriate diagnostics. */
|
||||||
|
const unsigned int STF_USER_VISIBLE = 1U;
|
||||||
|
+const unsigned int STF_STRIP_DEPENDENT = 1U << 1;
|
||||||
|
|
||||||
|
/* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
|
||||||
|
node. */
|
||||||
|
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
|
||||||
|
index ba635d4ddbd..6c39c004b01 100644
|
||||||
|
--- a/gcc/cp/tree.c
|
||||||
|
+++ b/gcc/cp/tree.c
|
||||||
|
@@ -1488,7 +1488,8 @@ strip_typedefs (tree t, bool *remove_attributes, unsigned int flags)
|
||||||
|
if (t == TYPE_CANONICAL (t))
|
||||||
|
return t;
|
||||||
|
|
||||||
|
- if (dependent_alias_template_spec_p (t))
|
||||||
|
+ if (!(flags & STF_STRIP_DEPENDENT)
|
||||||
|
+ && dependent_alias_template_spec_p (t))
|
||||||
|
/* DR 1558: However, if the template-id is dependent, subsequent
|
||||||
|
template argument substitution still applies to the template-id. */
|
||||||
|
return t;
|
||||||
|
@@ -1673,7 +1674,8 @@ strip_typedefs (tree t, bool *remove_attributes, unsigned int flags)
|
||||||
|
&& !user_facing_original_type_p (t))
|
||||||
|
return t;
|
||||||
|
result = strip_typedefs (DECL_ORIGINAL_TYPE (TYPE_NAME (t)),
|
||||||
|
- remove_attributes, flags);
|
||||||
|
+ remove_attributes,
|
||||||
|
+ flags | STF_STRIP_DEPENDENT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = TYPE_MAIN_VARIANT (t);
|
||||||
|
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-1.C
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..c3f7b1977db
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-1.C
|
||||||
|
@@ -0,0 +1,9 @@
|
||||||
|
+// { dg-require-effective-target c++11 }
|
||||||
|
+
|
||||||
|
+template<typename> struct A {};
|
||||||
|
+template<typename T1, typename T2 = typename T1::value> using alias1 = A<T1>;
|
||||||
|
+template<typename T> class B {
|
||||||
|
+ using alias2 = alias1<A<T>>; // { dg-error {no type named 'value'} }
|
||||||
|
+ A<alias2> a; // { dg-bogus {no type named 'value'} }
|
||||||
|
+};
|
||||||
|
+B<int> b;
|
||||||
|
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-2.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-2.C
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..31d73d6bad3
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-2.C
|
||||||
|
@@ -0,0 +1,14 @@
|
||||||
|
+// { dg-require-effective-target c++11 }
|
||||||
|
+
|
||||||
|
+template <bool> struct A;
|
||||||
|
+class Vector {
|
||||||
|
+ template <typename> struct TypeIsGCThing {
|
||||||
|
+ template <typename T, typename A<T ::value>::Type> using Vector = Vector;
|
||||||
|
+ struct B;
|
||||||
|
+ template <typename> class ContainerIter {
|
||||||
|
+ using Action = B;
|
||||||
|
+ using ActionVector = Vector<Action, 0>;
|
||||||
|
+ ContainerIter<ActionVector> a;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-3.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-3.C
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..6698a366411
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-3.C
|
||||||
|
@@ -0,0 +1,8 @@
|
||||||
|
+// { dg-require-effective-target c++11 }
|
||||||
|
+
|
||||||
|
+template <typename> void a();
|
||||||
|
+template <typename> struct b;
|
||||||
|
+template <bool> using c = int;
|
||||||
|
+template <typename d, typename e = decltype(a<d>)> using f = e;
|
||||||
|
+template <typename e> using g = f<e>;
|
||||||
|
+template <typename h> c<b<g<h>>::i> j;
|
||||||
9
gcc.spec
9
gcc.spec
@ -1,4 +1,4 @@
|
|||||||
%global DATE 20210104
|
%global DATE 20210115
|
||||||
|
|
||||||
%global gcc_version 9.3.1
|
%global gcc_version 9.3.1
|
||||||
%global gcc_major 9.3.1
|
%global gcc_major 9.3.1
|
||||||
@ -59,7 +59,7 @@
|
|||||||
Summary: Various compilers (C, C++, Objective-C, ...)
|
Summary: Various compilers (C, C++, Objective-C, ...)
|
||||||
Name: gcc
|
Name: gcc
|
||||||
Version: %{gcc_version}
|
Version: %{gcc_version}
|
||||||
Release: %{DATE}.14
|
Release: %{DATE}.15
|
||||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
|
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
|
||||||
URL: https://gcc.gnu.org
|
URL: https://gcc.gnu.org
|
||||||
|
|
||||||
@ -220,6 +220,7 @@ Patch103: re-PR-target-91124-gcc.target-i386-avx512vl-vpshldvd.patch
|
|||||||
Patch104: fix-avx512vl-vcvttpd2dq-2-fail.patch
|
Patch104: fix-avx512vl-vcvttpd2dq-2-fail.patch
|
||||||
Patch105: fix-issue604-ldist-dependency-fixup.patch
|
Patch105: fix-issue604-ldist-dependency-fixup.patch
|
||||||
Patch106: Apply-maximum-nunits-for-BB-SLP.patch
|
Patch106: Apply-maximum-nunits-for-BB-SLP.patch
|
||||||
|
Patch107: Fix-interaction-between-aka-changes-and-DR1558.patch
|
||||||
|
|
||||||
|
|
||||||
%global gcc_target_platform %{_arch}-linux-gnu
|
%global gcc_target_platform %{_arch}-linux-gnu
|
||||||
@ -769,6 +770,7 @@ not stable, so plugins must be rebuilt any time GCC is updated.
|
|||||||
%patch104 -p1
|
%patch104 -p1
|
||||||
%patch105 -p1
|
%patch105 -p1
|
||||||
%patch106 -p1
|
%patch106 -p1
|
||||||
|
%patch107 -p1
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -2700,6 +2702,9 @@ end
|
|||||||
%doc rpm.doc/changelogs/libcc1/ChangeLog*
|
%doc rpm.doc/changelogs/libcc1/ChangeLog*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jan 15 2021 eastb233 <xiezhiheng@huawei.com> - 9.3.1-20210115.15
|
||||||
|
- Fix-interaction-between-aka-changes-and-DR1558.patch: New file
|
||||||
|
|
||||||
* Mon Jan 04 2021 eastb233 <xiezhiheng@huawei.com> - 9.3.1-20210104.14
|
* Mon Jan 04 2021 eastb233 <xiezhiheng@huawei.com> - 9.3.1-20210104.14
|
||||||
- gcc.spec: Pack arm_bf16.h and arm_sve.h in aarch64 port
|
- gcc.spec: Pack arm_bf16.h and arm_sve.h in aarch64 port
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user