[llvm-bugs] [Bug 34953] New: Compiler crashes on partial specialization of variable template with template template parameter

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 14 21:58:05 PDT 2017


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

            Bug ID: 34953
           Summary: Compiler crashes on partial specialization of variable
                    template with template template parameter
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: insertinterestingnamehere at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

This template is valid, and does compile with clang 3.9 and clang 5.0, but not
with clang 4 or trunk. Trunk crashes, and clang 4 gives an error.
See also https://godbolt.org/g/NGQNCm.
Second similar example with structs further down.
To the best of my knowledge, both examples should be fine.


template <typename... param_types>
struct is_specified_instantiation_of {
  template <typename T, template <param_types...> class container>
  static constexpr bool value = false;

  template <template <param_types...> class container, param_types... params>
  static constexpr bool value<container<params...>, container> = true;

};

template <bool...>
struct bool_sequence {};

int main () {
  static_assert(is_specified_instantiation_of<bool, bool>::template 
    value<bool_sequence<true, false>, bool_sequence>, "");
}



A related example that compiles with 3.8 but either fails or crashes with later
(crashes with trunk, see also https://godbolt.org/g/ZyTERb)

template <typename... param_types>
struct is_specified_instantiation_of {
  template <typename T, template <param_types...> class container>
  struct val {
    static constexpr bool value = false;
  };

  template <template <param_types...> class container, param_types... params>
  struct val<container<params...>, container> {
    static constexpr bool value = true;
  };
};

template <bool...>
struct bool_sequence {};

int main () {
  static_assert(is_specified_instantiation_of<bool, bool>::template 
    val<bool_sequence<true, false>, bool_sequence>::value, "");
}

-- 
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/20171015/d8282e0a/attachment-0001.html>


More information about the llvm-bugs mailing list