<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 3, 2015 at 6:32 PM, Bataev, Alexey <span dir="ltr"><<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Hi Richard,<br>
      MSVC cl compiler allows mutable references even in user code, not
      only in system header files. I checked it and both 2012, 2013
      accepts the code from the test.<br></div></div></blockquote><div><br></div><div>That's beside the point. We're not trying to accept all the nonsense that MSVC accepts, only the extensions that are needed to get real code to work. Thus we would take patches for bugs/extensions that are used in system headers (and ideally these cases should still give errors if used outside system headers), and for bugs/extensions that are very common in user code.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div>
      I'll add extension warning.<br>
      <pre cols="72">Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team</pre>
      03.02.2015 20:25, Richard Smith пишет:<br>
    </div><div><div class="h5">
    <blockquote type="cite">
      <p dir="ltr">Please emit a warning when this extension is used. If
        we're only doing this to support a system header, you could even
        make it a DefaultError ExtWarn. Other than that, this looks
        fine.</p>
      <div class="gmail_quote">On 3 Feb 2015 02:32, "Alexey Bataev" <<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a>>
        wrote:<br type="attribution">
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi rsmith,<br>
          <br>
          Some standard header files from MSVC2012 use 'mutable' on
          references, though it is directly prohibited by the standard.<br>
          <br>
          <a href="http://reviews.llvm.org/D7370" target="_blank">http://reviews.llvm.org/D7370</a><br>
          <br>
          Files:<br>
            lib/Sema/SemaDecl.cpp<br>
            test/SemaCXX/ms_mutable_reference_member.cpp<br>
          <br>
          Index: lib/Sema/SemaDecl.cpp<br>
===================================================================<br>
          --- lib/Sema/SemaDecl.cpp<br>
          +++ lib/Sema/SemaDecl.cpp<br>
          @@ -12347,7 +12347,7 @@<br>
             // Check that 'mutable' is consistent with the type of the
          declaration.<br>
             if (!InvalidDecl && Mutable) {<br>
               unsigned DiagID = 0;<br>
          -    if (T->isReferenceType())<br>
          +    if (!getLangOpts().MSVCCompat &&
          T->isReferenceType())<br>
                 DiagID = diag::err_mutable_reference;<br>
               else if (T.isConstQualified())<br>
                 DiagID = diag::err_mutable_const;<br>
          Index: test/SemaCXX/ms_mutable_reference_member.cpp<br>
===================================================================<br>
          --- test/SemaCXX/ms_mutable_reference_member.cpp<br>
          +++ test/SemaCXX/ms_mutable_reference_member.cpp<br>
          @@ -0,0 +1,14 @@<br>
          +// RUN: %clang_cc1 %s -fsyntax-only -verify
          -fms-compatibility<br>
          +// expected-no-diagnostics<br>
          +<br>
          +struct S {<br>
          +  mutable int &a;<br>
          +  S(int &b) : a(b) {}<br>
          +};<br>
          +<br>
          +int main() {<br>
          +  int a = 0;<br>
          +  const S s(a);<br>
          +  s.a = 10;<br>
          +  return s.a + a;<br>
          +}<br>
          <br>
          EMAIL PREFERENCES<br>
            <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div></div>