December 14, 2006
"Walter Bright" wrote:
> Pavel Vozenilek wrote:
>> I read somewhere that unused members
>> can be optionally syntactically checked but not semantically.
>>
>>
>> A search on newsgroups seems to confirm this:
>>
>> Fergus Henderson: [T]he implementation _must not_ check
>> [unused template member] (other than
>> syntax checking)." (post from year 1995)
>>
>> http://groups.google.com/group/comp.std.c++/msg/0cb95f20593b7777
>
> But a friend is not a member.
>

Actually, DMC may be right
(disclaimer - no language lawyer):

Standard 14.5.3, section 3 says:

3. When a function is defined in a friend function declaration in a class
template, the function is defined when
the class template is first instantiated. The function is defined even if it
is never used. [Note: if the function
definition is illformed
for a given specialization of the enclosing class template, the program is
illformed
even if the function is never used. -end note]


Even if DMC is right perhaps a switch could be added
to ignore this error as lot of Boost code depends on it
and feels as rather un-natural limitation.

/Pavel


December 14, 2006
Pavel Vozenilek wrote:
> "Walter Bright" wrote:
>> Pavel Vozenilek wrote:
>>> I read somewhere that unused members
>>> can be optionally syntactically checked but not semantically.
>>>
>>>
>>> A search on newsgroups seems to confirm this:
>>>
>>> Fergus Henderson: [T]he implementation _must not_ check
>>> [unused template member] (other than
>>> syntax checking)." (post from year 1995)
>>>
>>> http://groups.google.com/group/comp.std.c++/msg/0cb95f20593b7777
>> But a friend is not a member.
>>
> 
> Actually, DMC may be right
> (disclaimer - no language lawyer):
> 
> Standard 14.5.3, section 3 says:
> 
> 3. When a function is defined in a friend function declaration in a class template, the function is defined when
> the class template is first instantiated. The function is defined even if it is never used. [Note: if the function
> definition is illformed
> for a given specialization of the enclosing class template, the program is illformed
> even if the function is never used. -end note]

Does Boost have a bug report submittal process?

> Even if DMC is right perhaps a switch could be added
> to ignore this error as lot of Boost code depends on it
> and feels as rather un-natural limitation.

That's a reasonable idea.
December 14, 2006
I'm asking the question on comp.lang.c++.moderated. We'll see!
December 23, 2006
Pavel Vozenilek wrote:
> Actually, DMC may be right

As James Kanze explained on comp.lang.c++.moderated, DMC++ is correct according to the Standard. However, nobody else does it that way, and the Standard is going to be changed to make such code correct.

There's no use in swimming against the tide, so I'll change DMC++ to conform to common practice.
1 2
Next ›   Last »