⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptrmem2.c

📁 gcc-you can use this code to learn something about gcc, and inquire further into linux,
💻 C
字号:
// { dg-do compile }// Copyright (C) 2001 Free Software Foundation, Inc.// Contributed by Nathan Sidwell 31 Dec 2001 <nathan@codesourcery.com>// PR 4379. We created pointers to member references and pointers to// member fields when we shouldn't have.struct D {    int &m;   // { dg-error "member `D::m' is non-static" "" }  static int &s;    int Foo ();};template<class T> int f1(T x);template<class T> int f2(T x);int D::Foo (){  f1( &D::m);   // { dg-error "cannot create pointer to ref" "" }  f1( &(D::m));	// ok  f2( &D::s);   // ok  f2( &(D::s)); // ok  return 0;}int Foo (){  f1( &D::m);    // { dg-error "cannot create pointer to ref" "" }  f1( &(D::m));  // { dg-error "at this point" "" }  f2( &D::s);    // ok  f2( &(D::s));  // ok  return 0;}

⌨️ 快捷键说明

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