This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52688] static local variable can accessed from local class of function template
- From: "sir_nawaz959 at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 24 Mar 2012 15:25:22 +0000
- Subject: [Bug c++/52688] static local variable can accessed from local class of function template
- Auto-submitted: auto-generated
- References: <bug-52688-4@http.gcc.gnu.org/bugzilla/>
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.