[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison 3.1 api.value.type {semantic_type} error in gcc8
From: |
Hans Åberg |
Subject: |
Re: Bison 3.1 api.value.type {semantic_type} error in gcc8 |
Date: |
Wed, 17 Oct 2018 17:52:26 +0200 |
> On 16 Oct 2018, at 18:21, Akim Demaille <address@hidden> wrote:
>
>> Le 16 oct. 2018 à 14:57, Hans Åberg <address@hidden> 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;
}
--