typename6.c

来自「xml大全 可读写调用率很高 xml大全 可读写调用率很高」· C语言 代码 · 共 18 行

C
18
字号
// { dg-do compile }
// Contributed by Matt Austern <austern at apple dot com>
// PR c++/13407: Gracefully handle keyword typename in base class specifier.

struct A { };
struct B { typedef A Type; };

template <typename T>
struct X : 
  public typename T::Type  // { dg-error "not allowed in this context" }
{ };

X<B> x;

struct C : 
  public typename A        // { dg-error "not allowed outside of templates" }
{ };

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?