2

我正在使用带有 libTooling 库的 clang 编译器前端开发 C++ 解析器。

对于来自 LLVM Clang 测试的以下代码

// It is deleted if the corresponding constructor [...] is deleted.
struct G {
  G(int) = delete; // expected-note {{'G' has been explicitly marked deleted here}}
  template<typename T> G(T*) = delete; // expected-note {{'G<const char>' has been explicitly marked deleted here}}
};
struct H : G {
  using G::G; // expected-note 2{{deleted constructor was inherited here}}
};
H h1(5); // expected-error {{call to deleted constructor of 'H'}}
H h2("foo"); // expected-error {{call to deleted constructor of 'H'}}

以下代码的 AST 是

在此处输入图像描述

请看第二个橙色框,这个函数没有在类 H 中显式声明,但它是从基类继承的,它引用了红色框中突出显示的相同模板类型。

我的问题是,我不想访问 H 类中的继承函数。那么如何跳过或忽略继承函数?

谢谢,赫曼特

4

0 回答 0