[Bug c++/52688] static local variable can accessed from local class of function template

sir_nawaz959 at yahoo dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 24 16:32:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52688

--- Comment #3 from Sarfaraz Nawaz <sir_nawaz959 at yahoo dot com> 2012-03-24 15:25:22 UTC ---
(In reply to comment #2)
> http://gcc.gnu.org/wiki/VerboseDiagnostics#missing_static_const_definition

Jonathan, that is a different case. A static (const or otherwise) member of a
class needs a definition in order to take its address, but the bug I reported
is not about static member of a class, rather it is about a static variable
local to a function template. Interestingly as I said, this code compiles fine
in gcc-4.5.1, but not in gcc-4.6.1. 


Also, if I do the same in a non-template function, it works fine, as expected.



More information about the Gcc-bugs mailing list