Invalid warning 'label x defined but not used' in template functions (egcs-19990907)

Jeroen@MMR.be Jeroen@MMR.be
Mon Sep 13 08:13:00 GMT 1999


template <typename T>
void f()
{
  for(;;)
    for(;;)
      goto a;

 a:
  ;
}

void g()
{
  f<long>();
}

//g++ -v
// Reading specs from
/hdc1/home2/egcs/experimental/lib/gcc-lib/i686-pc-linux-gnu/2.96/specs
// gcc version 2.96 19990907 (experimental)

// g++ -W -Wall -c f.cpp
// f.cpp: In function `void f()':
// f.cpp:8: warning: label `a' defined but not used
// f.cpp: In function `void f<long int>()':
// f.cpp:14:   instantiated from here
// f.cpp:8: warning: label `a' defined but not used

// this doesn't happen when the function (f) is not a template
--
Jeroen Dobbelaere
Software Design Engineer
Micro-Matic Research < http://www.mmr.be >




More information about the Gcc-bugs mailing list