This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/44548] Link error when defining templated static const variable



------- Comment #2 from dpovey at gmail dot com  2010-06-15 22:19 -------
I don't agree with you that this is not a bug, although I do agree that I could
have coded it differently.

Look at

http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/explicit_specialization.htm

the section on  "Explicit specialization of members of class templates".

You are right, my syntax was an explicit specialization, and that was pointless
and I could have done it a different way, but I believe what I wrote still
counts as  a definition of the variable-- what else could the syntax possibly
mean?  I.e. the line:
template<> const int MyTraits<int>::kValue;
You say this is an explicit specialization; fine, but it is an explicit
specialization of the *definition* of the variable. You can't *declare* a class
member outside of the class itself, and I'm not specializing the class itself. 
So either that line needs to be rejected by the compiler, or it needs to work
as I intended-- what other possible meaning could it have than the one I
intended?  The C++ standard doesn't seem to mention whether or not you are
allowed to explicitly specialize static const variables that have been defined
inside the class, and it does seem a bit pointless to do so, but I think it
should either compile or issue an error or warning. 


-- 

dpovey at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]