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

            Bug ID: 34368
           Summary: Const-qualified derived object can call a non-const
                    base member-function.
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangb...@nondot.org
          Reporter: delrieut...@gmail.com
                CC: llvm-bugs@lists.llvm.org

Hello, I have the bug same bug than the one reported in
https://bugs.llvm.org/show_bug.cgi?id=27398.

The funny thing is that when compiling with -std=c++1z, the code correctly gets
rejected, whereas -std=c++11/14 doesn't emit any error.

#include <utility>

struct base
{
  void f() {}
};

struct derived : base{};

int main(int argc, char const *argv[])
{
  derived const d;

  using should_not_compile = decltype((std::declval<derived
const&>().*std::declval<decltype(&base::f)>())());
}

Is there a workaround to that? I started to implement traits
(is_correctly_cv_qualified and such) but that'd be great if I could solve this
in an easier way.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to