Re: c++ build flags, clang++, -Wnomismatched-tags?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 21, 2016 at 12:49 AM, Gregory Farnum <gfarnum@xxxxxxxxxx> wrote:
> On Wed, Jan 20, 2016 at 3:07 PM, Matt Benjamin <mbenjamin@xxxxxxxxxx> wrote:
>> My annoyance with this warning is that I don't really want to see "friend struct foo" decls, which seems vaguely bogus?  The warnings could be eliminated by using class everywhere and adding public specifier where expected--but we shouldn't have to do that...
>
> Do we know what other class of issues this flag warns us on? I
> actually think it might be good to be consistent about the
> struct/class distinction but don't have a strong opinion on it as long
> as we aren't masking something else by zapping the warning.

I think the reason this warning exists has to do with Microsoft
compilers, which used to (?) mangle structs and classes differently,
leading to link errors.

>From the errata to Herb Sutter's "Exceptional C++" [1]:

"It's perfectly legal and standards-conforming to forward-declare
a class as a struct and vice versa. In most of the book I've tended to
avoid doing that, though. Why? Only because some compilers are buggy
and still don't get this right -- e.g., by name-mangling a class and
a struct differently, which will cause the linker to fail to match them
up. Such compiler bugs really are bugs and are wrong, but they're
common enough that we might as well avoid the issue by not relying on
this standard feature. Sigh."

It looks like MSVC 6 at least was among those compilers.  I assume it
was fixed, but this warning is still there in the latest Visual Studio [2].

[1] http://www.gotw.ca/publications/xc++-errata.htm
[2] https://msdn.microsoft.com/en-us/library/695x5bes.aspx

I doubt there is anything else we would mask by zapping it.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux