> On 16 Oct 2018, at 18:21, Akim Demaille <a...@lrde.epita.fr> wrote:
> 
>> Le 16 oct. 2018 à 14:57, Hans Åberg <haber...@telia.com> a écrit :
>> 
>> The minimal example below compiles with clang++6, but not with g++8. One 
>> would think that it should define a qualified name B::A, used as
>> mu::B::A a;
>> as in the other cases below. But I have it probably by legacy since when 
>> Bison used YYSTYPE only, though.
> 
> Concretely, it is my understanding that this is irrelevant
> to Bison, isn’t it?

One can use templates—in the example below, B is the parser, and A the semantic 
type. That would be using C++ paradigms rather than writing the code directly.

--
#include <iostream>
#include <string>

namespace mu {
  class A {};

  template<typename T>
  class B {
  public:
    typedef T A;
  };
}

int main () {
  mu::B<mu::A>::A a;
  mu::A b;

  return 0;
}
--


Reply via email to