view gcc/testsuite/g++.dg/parse/pr34758.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 34758 Bad diagnostic for circular dependency in constructor default argument
// { dg-do compile }
// { dg-options "" }
struct A
{
  A (const A& = A()); // { dg-error "recursive evaluation of default argument" }
};


struct S {
  S(const S& = f()); // { dg-error "default argument\[^\n\]*which is not yet defined" }
  static const S& f(int i = 3);
};

struct J {
  J(const J& = f(2)); // { dg-error "default argument.*which is not yet defined" }
  static const J& f(int i = 3, int j = 4);
};

struct Z {
  Z(const Z& = f(4));
  static const Z& f(int i = 3);
};

struct X {
  X(const X& = g());
  static const X& g(void);
};