view gcc/testsuite/g++.dg/init/pr43064-1.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

/* Verify that errors about member initializers appear at the bad value,
   rather than on the last token of the final initializer.  */

// { dg-do compile }
// { dg-options "-fdiagnostics-show-caret" }

class X {
  X() : bad(42), // { dg-error "invalid conversion from 'int' to 'void\\*'" }
	good(42)
  { }
  
  void* bad;
  int good;

  /* { dg-begin-multiline-output "" }
   X() : bad(42),
             ^~
             |
             int
     { dg-end-multiline-output "" } */
};

class Y {
  Y() : bad(-1), // { dg-error "invalid conversion from 'int' to 'void\\*'" }
	good(42)
  { }
  
  void* bad;
  int good;

  /* { dg-begin-multiline-output "" }
   Y() : bad(-1),
             ^~
             |
             int
     { dg-end-multiline-output "" } */
};