view gcc/testsuite/g++.dg/lookup/exception1.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* PR 2743 */
/* { dg-do compile } */

namespace ns {
  class Exception
  {
  };
}

namespace ns
{
  class Test {
    public:
      inline Test()
#if __cplusplus <= 201402L
      throw( Exception )			// { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
#endif
      ;
      inline Test(int n )
#if __cplusplus <= 201402L
      throw( Exception )			// { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
#endif
      ;
    private:
      int i;
  };
}

// This line used to fail because Exception wasn't looked up in the
// right scope.
ns::Test::Test()
#if __cplusplus <= 201402L
throw( Exception )				// { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
#endif
: i( 1 )
{
}

ns::Test::Test( int n )
#if __cplusplus <= 201402L
throw( Exception )				// { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
#endif
: i( n )
{
}

int main(int argc, char* argv[]) {
  ns::Test test;
}