re PR c++/23959 (-Wswitch-default reports missing default in a template that has one)
2005-10-16 Andrew Pinski <pinskia@physics.uc.edu> PR c++/23959 * decl.c (pop_switch): Only call c_do_switch_warnings when not processing templates. 2005-10-16 Andrew Pinski <pinskia@physics.uc.edu> PR c++/23959 * g++.dg/warn/Wswitch-default-1.C: New test. * g++.dg/warn/Wswitch-default-2.C: New test. From-SVN: r105466
This commit is contained in:
parent
5bf8b82d52
commit
dddf9a0a08
@ -1,3 +1,9 @@
|
|||||||
|
2005-10-16 Andrew Pinski <pinskia@physics.uc.edu>
|
||||||
|
|
||||||
|
PR c++/23959
|
||||||
|
* decl.c (pop_switch): Only call c_do_switch_warnings
|
||||||
|
when not processing templates.
|
||||||
|
|
||||||
2005-10-16 Mark Mitchell <mark@codesourcery.com>
|
2005-10-16 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
PR c++/22173
|
PR c++/22173
|
||||||
|
@ -2415,6 +2415,7 @@ pop_switch (void)
|
|||||||
switch_location = EXPR_LOCATION (cs->switch_stmt);
|
switch_location = EXPR_LOCATION (cs->switch_stmt);
|
||||||
else
|
else
|
||||||
switch_location = input_location;
|
switch_location = input_location;
|
||||||
|
if (!processing_template_decl)
|
||||||
c_do_switch_warnings (cs->cases, switch_location,
|
c_do_switch_warnings (cs->cases, switch_location,
|
||||||
SWITCH_STMT_TYPE (cs->switch_stmt),
|
SWITCH_STMT_TYPE (cs->switch_stmt),
|
||||||
SWITCH_STMT_COND (cs->switch_stmt));
|
SWITCH_STMT_COND (cs->switch_stmt));
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2005-10-16 Andrew Pinski <pinskia@physics.uc.edu>
|
||||||
|
|
||||||
|
PR c++/23959
|
||||||
|
* g++.dg/warn/Wswitch-default-1.C: New test.
|
||||||
|
* g++.dg/warn/Wswitch-default-2.C: New test.
|
||||||
|
|
||||||
2005-10-16 Mark Mitchell <mark@codesourcery.com>
|
2005-10-16 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
PR c++/22173
|
PR c++/22173
|
||||||
|
22
gcc/testsuite/g++.dg/warn/Wswitch-default-1.C
Normal file
22
gcc/testsuite/g++.dg/warn/Wswitch-default-1.C
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// PR C++/21123
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-Wswitch-default" } */
|
||||||
|
|
||||||
|
|
||||||
|
template <typename ArrayType>
|
||||||
|
void foo( )
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
switch ( i ) /* { dg-bogus "switch missing default case" } */
|
||||||
|
{
|
||||||
|
case 9:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
foo<int>();
|
||||||
|
}
|
21
gcc/testsuite/g++.dg/warn/Wswitch-default-2.C
Normal file
21
gcc/testsuite/g++.dg/warn/Wswitch-default-2.C
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// PR C++/21123
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-Wswitch-default" } */
|
||||||
|
|
||||||
|
|
||||||
|
template <typename ArrayType>
|
||||||
|
void foo( )
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
switch ( i ) /* { dg-warning "switch missing default case" } */
|
||||||
|
{
|
||||||
|
case 9:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
foo<int>();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user