[Dune-devel] [Dune-Commit] dune-istl r1656 - trunk/dune/istl

Jö Fahlke jorrit at jorrit.de
Wed Jul 18 17:04:40 CEST 2012


Am Wed, 18. Jul 2012, 15:52:48 +0200 schrieb Christoph Grüninger:
> Clang complains about mixing struct and class with a warning. Since
> Clang 3.0 compiles Dune for me and I think other people are using
> it, too. Microsoft's Visual-C++ 2008 seems to warn about this issue,
> too.
> 
> I am not that C++-savvy to answer your question. But other people
> who are tend to see them as interchangeable, see for example [1].

OK, so this looks like another bogus warning to me.  At least this one doesn't
require much bending-over-backwards in the majority of cases.

> >In particular for friend declarations in templates you sometimes don't know
> >whether the friend class has been defined with 'class' or 'struct'.
> 
> But you need at least a header with a forward declaration and there
> you could see whether it's a class or a struct.

Example (from the C++11 standard draft N3242=11-0012, clause 14.5.4 Friends
[temp.friend], somewhat adapted to show my point):

  template<class T> struct A {
    struct B { };
  };
  template<> struct A<int> {
    class B { };
  };

  class C {
    template<class T> friend struct A<T>::B;
  };

Regards,
Jö.


-- 
Jorrit (Jö) Fahlke, Interdisciplinary Center for Scientific Computing,
Heidelberg University, Im Neuenheimer Feld 368, D-69120 Heidelberg
Tel: +49 6221 54 8890 Fax: +49 6221 54 8884

If God had intended Man to Smoke, He would have set him on Fire.
-- fortune
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20120718/bb7df59d/attachment.sig>


More information about the Dune-devel mailing list