view gcc/testsuite/g++.dg/cpp0x/explicit7.C @ 131:84e7813d76e9

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

// [over.match.conv]: For direct-initialization, those explicit conversion
// functions that are not hidden within S and yield type T or a type that
// can be converted to type T with a qualification conversion (4.4) are
// also candidate functions.

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

struct A { };
struct B: A { };
struct C {
  explicit operator B*();	// { dg-message "explicit" }
  explicit operator B&();	// { dg-message "explicit" }
};

C c;
A* ap (c);			// { dg-error "" }
A& ar (c);			// { dg-error "" }