[llvm-bugs] [Bug 47174] New: ICE with concepts

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 14 17:34:52 PDT 2020


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

            Bug ID: 47174
           Summary: ICE with concepts
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at marehr.dialup.fu-berlin.de
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Hi clang-team,

(maybe you find a better summary)

the following code ICEs

```c++
#include <vector>
namespace ranges {
template <bool> struct if_then { template <typename T> using apply = T; };
template <typename I> char is_std_iterator_traits_specialized_impl_(void *);
template <typename I>
inline constexpr bool is_std_iterator_traits_specialized_v = 1 ==
sizeof(is_std_iterator_traits_specialized_impl_<I>(static_cast<std::iterator_traits<I>
*>(nullptr)));
} // namespace ranges
namespace concepts {
template <typename T, typename U>
using common_reference_t = decltype(true ? std::declval<T &>() : std::declval<T
&>());

template <typename T, typename U>
concept common_reference_with = requires()
{
  typename common_reference_t<T, U>;
};
} // namespace concepts
namespace ranges {
template <typename R>
using iter_value_t = typename
if_then<is_std_iterator_traits_specialized_v<R>>::template
apply<std::iterator_traits<R>>::value_type;

template <typename T>
concept input_range = ::concepts::common_reference_with<char &,
iter_value_t<typename T::iterator> &>;
} // namespace ranges
namespace seqan3 {
template <typename rng_t>
concept sequence = ranges::input_range<rng_t> && std::is_same_v<rng_t,
std::vector<char>>;

template <typename type>
struct debug_stream_printer;
} // namespace seqan3

template <typename rng_t> concept any_type = true;

namespace seqan3 {
template <ranges::input_range rng_t>
requires any_type<rng_t>
struct debug_stream_printer<rng_t> {};

template <sequence sequence_t>
requires any_type<sequence_t>
struct debug_stream_printer<sequence_t> {};
} // namespace seqan3

int main()
{
  seqan3::debug_stream_printer<std::vector<char>>{};
}
```

https://godbolt.org/z/fj9E73

with

> clang++-git -std=c++2a ./ice.cpp

This code is a reduction from code that uses the ranges-v3 library.

-- 
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/20200815/062a8a86/attachment.html>


More information about the llvm-bugs mailing list