This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] PR 58435


Hi,

for this kind of code:

template <template <typename> class F, typename T> struct apply
{ typedef F<T> type; };

template <typename T> using map = const T;

static_assert(std::is_same<apply<map, int>::type, const int>::value, "");

line #11542 of pt.c, in tsubst is reached:

        r = lookup_template_class (arg,
                       argvec, in_decl,
                       DECL_CONTEXT (arg),
                        /*entering_scope=*/0,
                       complain);
        return cp_build_qualified_type_real
          (r, cp_type_quals (t), complain);

for the 'typedef F<T> type;' with t, the typedef, which evidently has cp_type_quals (t) == 0, thus unqualified. The information about const T in the alias declaration is contained in r. Thus I believe we have simply to OR the two cp_type_quals, like we do in other cases. We also OR for case [TEMPLATE_TYPE_PARM] a few lines above.

Tested x86_64-linux.

Thanks!
Paolo.

////////////////////////

Attachment: CL_58435
Description: Text document

Attachment: patch_58435
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]