template13.c
来自「用于进行gcc测试」· C语言 代码 · 共 24 行
C
24 行
// { dg-do compile }// Templates defined outside must be declared insidenamespace bar{ // trick it to provide some prior declaration template<class T> void foo(); // { dg-error "definition" } template<class T>class X; // { dg-error "note: previous declaration" }}template <typename T>T constbar::foo(T const &a) // { dg-error "" "" { xfail *-*-* } } not declared in bar - { return a;}template<> void bar::foo<int>() // { dg-error "different namespace" }{}template<class T,class U>class bar::X{}; // { dg-error "error: redeclared with 2 template parameter" }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?