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

            Bug ID: 26271
           Summary: erroneous error of circular inheritance
           Product: clang
           Version: 3.7
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangb...@nondot.org
          Reporter: hui...@me.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

I could be wrong but I don't think the following code has circular inheritance.
And gcc6 compiles it just fine.

#include <type_traits>
#include <utility>

enum color
{
   red,
   green,
   yellow
};

enum shape
{
   circle,
   square
};

template < color... c >
using colors = std::integer_sequence<color,c...>;

template < shape... s >
using shapes = std::integer_sequence<shape,s...>;

template < color, shape >
struct object
{};

template < typename, typename >
struct objects;

template < color c, shape s >
struct objects<colors<c>,shapes<s>>
 : object<c,s>
{};

template < color c, shape... s >
struct objects<colors<c>,shapes<s...>>
 : object<c,s>...
{};

template < color... c, shape... s >
struct objects<colors<c...>, shapes<s...>>
 : objects<colors<c>,shapes<s...>>...
{};

int main(int argc, const char * argv[])
{
   objects<colors<red,green>,shapes<circle>> x;
   object<red,circle>& r = x;
   (void)r;
}


clang++-mp-3.7 -std=c++1z main.cpp
main.cpp:42:4: error: circular inheritance between 'objects<colors<c>,
shapes<s...> >' and 'objects<integer_sequence<color,
      c...>, integer_sequence<shape, s...> >'
 : objects<colors<c>,shapes<s...>>...
   ^

-- 
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