[llvm-bugs] [Bug 37691] New: Conversion to ambiguous/inaccessible rvalue base is valid in unevaluated context

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 5 08:14:36 PDT 2018


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

            Bug ID: 37691
           Summary: Conversion to ambiguous/inaccessible rvalue base is
                    valid in unevaluated context
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: johelegp at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

In the following snippet, the assertions fail. See
https://godbolt.org/g/F2sZSR.

```C++
#include <utility>

template <class To, class From>
constexpr bool is_static_castable(...)
{
    return false;
};

template <
    class To, class From,
    class = decltype(static_cast<To>(std::declval<From>()))>
constexpr bool is_static_castable(int)
{
    return true;
};

struct B {
};

struct D : B {
};

struct D2
  : D
  , B {
};

static_assert(!is_static_castable<B&&, D2>(0), "");

struct D3 : private B {
};

static_assert(!is_static_castable<B&&, D3>(0), "");
```

-- 
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/20180605/90b9949f/attachment.html>


More information about the llvm-bugs mailing list