view gcc/testsuite/g++.dg/warn/Wshadow-4.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR c++/39526
// { dg-options "-Wshadow" }

class INetURLObject
{
public:
    INetURLObject(int i);
    int GetMainURL() const;
};

int foo(int infoo)		// { dg-bogus "shadowed declaration" }
{
  int outfoo( INetURLObject( infoo ).GetMainURL()); // { dg-bogus "shadows" }
  extern void f(int infoo);
  struct A
  {
    void f(int infoo) { }	// { dg-bogus "shadows a parameter" }
  };
  return outfoo;
}

// PR c++/39763
int foo2(void)
{
    int infoo = 0;		// { dg-bogus "shadowed declaration" }
    int outfoo( INetURLObject( infoo ).GetMainURL()); // { dg-bogus "shadows" }
    struct A
    {
      void f(int infoo) { }	// { dg-bogus "shadows a previous local" }
    };
    return outfoo;
}