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

// { 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 } } }
};