[llvm-bugs] [Bug 26093] New: Passing template alias as template template parameter causes specialization matching to fail

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 8 16:54:08 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26093

            Bug ID: 26093
           Summary: Passing template alias as template template parameter
                    causes specialization matching to fail
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: grygoriy.fuchedzhy at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Hi, here is example of code which I believe valid, compiles using gcc-4.9.3 but
fails to compile with clang-3.5.2, clang-3.6.2 and 3.7.0.

template<bool val> struct bool_type
{
      static constexpr bool value = val;
};

template<typename T, template<typename...> class Template>
struct inst_of : bool_type<false> {};

template<template<typename...> class Template, typename... Params>
struct inst_of<Template<Params...>, Template> : bool_type<true> {};

template<typename X>
struct some_templ;

template<typename X>
using some_alias = some_templ<X>;

static_assert(inst_of<some_templ<int>, some_templ>::value, "");//ok
static_assert(inst_of<some_alias<int>, some_templ>::value, "");//ok
static_assert(inst_of<some_alias<int>, some_alias>::value, "");//assert
static_assert(inst_of<some_templ<int>, some_alias>::value, "");//assert

//some more tests
template<typename T>
struct inst_of_some_templ : bool_type<false> {};
template<typename T>
struct inst_of_some_templ<some_templ<T>> : bool_type<true> {};

template<typename T>
struct inst_of_some_alias : bool_type<false> {};
template<typename T>
struct inst_of_some_alias<some_alias<T>> : bool_type<true> {};

static_assert(inst_of_some_templ<some_templ<int>>::value, "");//ok
static_assert(inst_of_some_templ<some_alias<int>>::value, "");//ok
static_assert(inst_of_some_alias<some_alias<int>>::value, "");//ok
static_assert(inst_of_some_alias<some_templ<int>>::value, "");//ok

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160109/25004a23/attachment.html>


More information about the llvm-bugs mailing list