view gcc/testsuite/g++.dg/cpp0x/constexpr-using3.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

// { dg-do compile { target c++11 } }
// { dg-options "-pedantic" }

namespace ns { typedef int T; }

constexpr int Test1(int x) { using ns::T; typedef T U; return U(x); }
constexpr int Test2(int x) { using namespace ns; typedef T U; return U(x); }
constexpr int Test3(int x) { { using ns::T; typedef T U; return U(x); } }  // { dg-warning "compound-statement" "" { target { c++11_only } } }
constexpr int Test4(int x) { { using namespace ns; typedef T U; return T(x); } }  // { dg-warning "compound-statement" "" { target { c++11_only } } }

struct S1
{
  constexpr S1() { using ns::T; typedef T U; }
};

struct S2
{
  constexpr S2() { using namespace ns; typedef T U; }
};

struct S3
{
  constexpr S3() { { using ns::T; typedef T U; } }  // { dg-warning "compound-statement" "" { target { c++11_only } } }
};

struct S4
{
  constexpr S4() { { using namespace ns; typedef T U; } }  // { dg-warning "compound-statement" "" { target { c++11_only } } }
};