Clang cannot handle template specialized specialization using the link template template, but GCC can

In my general architecture, I am using a pattern similar to the one below. It compiles and works correctly in GCC 5.2.0:

#include <iostream>
using namespace std;


template<class Baz>
class Foo
{
public:
    void foo(){cout<<"Foo method";}
};


template<template<class> class FooType>
class BarBase: public FooType<int>
{
public:    
    double bar() {cout<<"Generic bar";}
};

template<template<class> class FooType>
class Bar: public BarBase<FooType>
{
};

template<>
class Bar<Foo>: public BarBase<Foo>
{
public:
    void specialBar(){cout<<"Specialized bar";}
};

struct Aspect_Foo
{
    template<class Baz>
    using FooTrait = Foo<Baz>;
};

struct Aspect_Bar
{    
    template<template<class> class FooType>
    using BarTrait = Bar<FooType>;
};


using Entity_NonAspectual = Bar<Foo>;


template<class FooAspect = Aspect_Foo,
         class BarAspect = Aspect_Bar>
using Entity_Aspectual = typename BarAspect::template BarTrait<
        FooAspect::template FooTrait>;


int main()
{  
  Entity_NonAspectual workingEntity;
  workingEntity.foo();
  workingEntity.bar();
  workingEntity.specialBar();

  Entity_Aspectual<> brokenEntity;

  brokenEntity.foo();
  brokenEntity.bar();
  brokenEntity.specialBar();
}

      

But in Clang 3.6, I get the following error when I call brokenEntity.specialBar ():

error: no member named 'specialBar' in 'Bar<FooTrait>'

      

Is this a compiler bug in Clang? Is there a workaround? I'm currently pretty comfortable with Visual Studio 2013 with LLVM and getting GCC to work with VS looks like a pain. I am open to suggestions for alternative combinations of IDE and Windows based compiler.

+3


source to share





All Articles