diff --git a/gcc-103-substitution-bug-fix.patch b/gcc-103-substitution-bug-fix.patch new file mode 100644 index 00000000000..9059d07b1e1 --- /dev/null +++ b/gcc-103-substitution-bug-fix.patch @@ -0,0 +1,78 @@ +--- a/gcc/cp/pt.c ++++ b/gcc/cp/pt.c +@@ -13750,45 +13750,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, + if (tree spec = retrieve_specialization (gen_tmpl, argvec, hash)) + return spec; + } +- +- /* We can see more levels of arguments than parameters if +- there was a specialization of a member template, like +- this: +- +- template struct S { template void f(); } +- template <> template void S::f(U); +- +- Here, we'll be substituting into the specialization, +- because that's where we can find the code we actually +- want to generate, but we'll have enough arguments for +- the most general template. +- +- We also deal with the peculiar case: +- +- template struct S { +- template friend void f(); +- }; +- template void f() {} +- template S; +- template void f(); +- +- Here, the ARGS for the instantiation of will be {int, +- double}. But, we only need as many ARGS as there are +- levels of template parameters in CODE_PATTERN. We are +- careful not to get fooled into reducing the ARGS in +- situations like: +- +- template struct S { template void f(U); } +- template template <> void S::f(int) {} +- +- which we can spot because the pattern will be a +- specialization in this case. */ +- int args_depth = TMPL_ARGS_DEPTH (args); +- int parms_depth = +- TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (t))); +- +- if (args_depth > parms_depth && !DECL_TEMPLATE_SPECIALIZATION (t)) +- args = get_innermost_template_args (args, parms_depth); + } + else + { +diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C +new file mode 100644 +index 00000000000..8009756dcba +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C +@@ -0,0 +1,9 @@ ++// PR c++/100102 ++// { dg-do compile { target c++11 } } ++ ++template struct ratio; ++template struct duration { ++ static constexpr int _S_gcd(); ++ template using __is_harmonic = ratio<_S_gcd>; ++ using type = __is_harmonic; ++}; +diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C +new file mode 100644 +index 00000000000..a4443e18f9d +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C +@@ -0,0 +1,9 @@ ++// PR c++/100102 ++// { dg-do compile { target c++11 } } ++ ++template struct ratio; ++template struct duration { ++ static constexpr int _S_gcd(); ++ template using __is_harmonic = ratio<(duration::_S_gcd)()>; ++ using type = __is_harmonic; ++}; diff --git a/gcc.spec b/gcc.spec index 12fbadeb883..46a64e5eb84 100644 --- a/gcc.spec +++ b/gcc.spec @@ -1,10 +1,10 @@ -### RPM external gcc 10.2.0 +### RPM external gcc 10.3.0 ## USE_COMPILER_VERSION ## INITENV +PATH LD_LIBRARY_PATH %{i}/lib64 # Use the git repository for fetching the sources. This gives us more control while developing # a new platform so that we can compile yet to be released versions of the compiler. # See: https://gcc.gnu.org/viewcvs/gcc/branches/gcc-8-branch/?view=log -%define gccTag fd7f82855134bc40c46f06c66413f1ec78404eca +%define gccTag f00b5710a30f22efc3171c393e56aeb335c3cd39 %define gccBranch releases/gcc-10 %define moduleName %{n}-%{realversion} @@ -42,10 +42,12 @@ Source11: https://github.com/westes/flex/releases/download/v%{flexVersion}/flex- Patch0: gcc-flex-nonfull-path-m4 Patch1: gcc-flex-disable-doc +Patch2: gcc-103-substitution-bug-fix %prep %setup -T -b 0 -n %{moduleName} +%patch2 -p1 # Filter out private stuff from RPM requires headers. cat << \EOF > %{name}-req