<html>
<head>
<meta content="text/html; charset=windows-1251"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">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>
I'll add extension warning.<br>
<pre class="moz-signature" cols="72">Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team</pre>
03.02.2015 20:25, Richard Smith ïčøåō:<br>
</div>
<blockquote
cite="mid:CAOfiQqn5ntnF=B2gJio_ajuO5VbNhSHfDNY-Jx6hhBypbz6Uww@mail.gmail.com"
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
moz-do-not-send="true" href="mailto:a.bataev@hotmail.com">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 moz-do-not-send="true" 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 moz-do-not-send="true"
href="http://reviews.llvm.org/settings/panel/emailpreferences/"
target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>