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
c ++ gcc templates clang template-specialization


source to share


No one has answered this question yet

See similar questions:

2
C ++ dynamic downcasting to class template with template template parameter being class template or alias template
0
Template and DLL Specialization: Visual Studio vs. (GCC / Clang)

or similar:

1643
Why templates can only be implemented in a header file?
33
Calling `this` member function from generic lambda clang vs gcc
23
Nested template classes with a pointer to a method not compiled in clang ++
12
Why clang rejects variable template name function
7
Is it legal to do partial intraclass specialization of a template member class in a derived class
6
std :: rbegin and std :: rend in GCC 4.9 and clang 3.5
4
Template parameter template with GCC
3
clang class vs gcc template using forward-declar class in parent
2
Invalid use of incomplete type for partial specialization of a C ++ template
1
gcc vs. clang: "invalid use of incomplete type" with std :: declval and template specialization



All Articles
Loading...
X
Show
Funny
Dev
Pics