[cfe-dev] clang issue with 'mutable' ?

Stefan Seefeld stefan at seefeld.name
Mon Oct 21 06:17:34 PDT 2013


Hello,

I have just run into an issue with some C++ code that I could reduce to
this case:

  template <typename T>
  struct wrapper
  {
    wrapper() : member() {}
    mutable T member;
  };

  int main()
  {
    wrapper<int const> w;
  }

clang would raise the error "'mutable' and 'const' cannot be mixed",
while the same compiles (and works !) fine with g++.

(Please note that the above may not look very meaningful, but in the
original case I extracted this from it definitely does :-) )

Could someone please confirm that this is a clang bug, or otherwise
explain if it is indeed illegal C++ ?

Many thanks,
		Stefan


-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the cfe-dev mailing list