member2.c

来自「linux下编程用 编译软件」· C语言 代码 · 共 42 行

C
42
字号
// { dg-do run }// Copyright (C) 2001 Free Software Foundation, Inc.// Contributed by Nathan Sidwell 17 Oct 2002 <nathan@codesourcery.com>// PR 7676. We didn't notice template members were different.struct foo{  template<class T>  int bar() {return 1;}    template<int I>  int bar() {return 2;}    };struct baz : foo{  using foo::bar;  template<int I>  int bar () {return 3;}};int main (){  baz b;  foo f;  if (f.bar<1> () != 2)    return 1;  if (f.bar<int> () != 1)    return 2;    if (b.bar<1> () != 3)    return 1;  if (b.bar<int> () != 1)    return 2;  return 0;}

⌨️ 快捷键说明

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