view gcc/testsuite/g++.dg/warn/Wimplicit-fallthrough-3.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

// Verify that there are no spurious warnings in nested switch statements due
// to the unnecessary break in the inner switch block.
// { dg-do compile }
// { dg-options "-Wimplicit-fallthrough" } */

int
foo (int c1, int c2, int c3)
{
  switch (c2)
    {
    case 0:   
      switch (c3)	// { dg-bogus "may fall through" }
	{
	case 0:
	  if (c1)
	    return 1;
	  else
	    return 2;
	  break;

	default:
	  return 3;
	}

    case 1: 
      return 4;
    default:
      return 5;
      break;
    }
}