This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: More test results...


Martin Sebor <sebor@roguewave.com> writes:

| Benjamin Kosnik wrote:
| > 
| > > Why I thought that would make any difference?  Because, my mental
| > > model of export is that it inhibits multiple definitions.
| > > Now I realize that explicit specialization is much more than "just
| > > provide alternate definition" for a generic thingy.
| > >
| > > Now, you have provided more than convincing arguments about your worries.
| > 
| > Agreed. I think Martin's example is pretty compelling, actually.
| 
| FWIW, I subsequently found out that the example doesn't compile with
| gcc 3.0.4 or EDG eccp 3.0, so I talked to John Spicer about it. He
| thinks it's ill-formed and that static const integral members
| initialized in the body of their parent class [template] are not (and
| should not) be allowed to be explicitly specialized. John points to
| 9.4.2, p4 which in his opinion disallows it (I can't say I read it that
| way).

Then, I'm in the same boat as you.  Here is what the standard text says

9.4.2/4 says 
 If a static data member is of const integral or const enumeration
 type, its declaration in the class definition can specify a
 constant-initializer which shall be an integral constant expression
 (5.19). In that case, the member can appear in integral constant
 expressions within its scope. The member shall still be defined in a
 namespace scope if it is used in the program and the namespace scope
 definition shall not con-tain an initializer.

I don't see anything in that paragraph that supports John's claim.

| I also tried the same code with HP aCC, IBM VisualAge and SunPro, all
| of which accept it. The first two, however, fail to use either the
| specialized value or the value in the primary template, so they
| probably work only by accident. Sun in the meantime acknowledged that
| the fact that the test case compiles is a bug and plan to diagnose it
| in the future (they fail to emit the symbol for the member of the
| primary template in a slightly more complicated test case and fail
| to link as a result).

Thanks for the input.  Do you think this worth raising as a DR on the core
list?  Although Jason's quote defeats my mental model, I find it much more
convincing that John's.

-- Gaby


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