<div dir="ltr">On Thu, Mar 7, 2013 at 12:40 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Thu, Mar 7, 2013 at 12:31 PM, Albert Wong (王重傑) <<a href="mailto:ajwong@google.com">ajwong@google.com</a>> wrote:<br>


> My understanding was that static data members needed to be defined, even if<br>
> they are integral types that are initialized with a constant expression with<br>
> an exception being made if they are not "odr-used."  (See<br>
> [class.static.data]p3)<br>
><br>
> I don't 100% understand odr-used but I think __regex_word's usage in a<br>
> non-const expression at line 1205 means this it needs to be defined and not<br>
> just declared.<br>
<br>
</div>In C++98 this is probably true (were you compiling in C++98 mode?). In<br>
C++11 I don't believe this is true.<br>
<br>
"A variable whose name appears as a potentially-evaluated expression<br>
is odr-used unless it is an<br>
object that satisfies the requirements for appearing in a constant<br>
expression (5.19) and the lvalue-to-rvalue<br>
conversion (4.1) is immediately applied"<br>
<br>
(what this basically means, as I understand it, is: so long as you<br>
don't need the "object" (eg: you don't take its address/want to point<br>
to it at any time) just the value, you don't need to provide<br>
definitions for constants)<br></blockquote><div><br></div><div style>Sounds sensible. Then I'm guessing gcc must be doing something silly. I was indeed building --std=c++11.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">
> As for making a test for this...it'd probably be difficult to write one that<br>
> was guaranteed to fail.  In the specific failure that prompted this, the<br>
> MIPS g++ somehow ended up with an unresolved symbol.  Oddly enough, the ARM<br>
> and x86 variants of the same compiler version didn't do this.<br>
<br>
</div>Do you have a MIPS bot or could contribute one? Some way to avoid<br>
regressing things like this would be helpful for yourself & the<br>
community.<br></blockquote><div><br></div><div style>Sadly, no.  I'm only 20% on the project to make libcxx work on Android (normally a Chrome dev) so I don't really have much knowledge about their builders, etc.  Also, until libcxx actually works on the Android toolchain, I doubt if such a bot would ever stay green.</div>

<div style><br></div><div style>-Albert</div><div style><br></div><div style> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">


><br>
> -Albert<br>
><br>
><br>
><br>
> On Thu, Mar 7, 2013 at 11:56 AM, Howard Hinnant <<a href="mailto:hhinnant@apple.com">hhinnant@apple.com</a>> wrote:<br>
>><br>
>> I don't have one.  In order for me to detect this I would have to take the<br>
>> address of __regex_word, and to the best I've been able to tell, on Apple<br>
>> platforms libc++ never does this.  However Albert Wong reported errors on<br>
>> MIPS Android which this addition fixed.  I did run the regex tests on OS X<br>
>> before and after this addition and they all passed.  I view this addition as<br>
>> benign on Apple platforms, and happy to help out on MIPS Android.<br>
>><br>
>> Howard<br>
>><br>
>> On Mar 7, 2013, at 2:47 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>><br>
>> > Is there a test case to go with this?<br>
>> ><br>
>> > On Thu, Mar 7, 2013 at 11:38 AM, Howard Hinnant <<a href="mailto:hhinnant@apple.com">hhinnant@apple.com</a>><br>
>> > wrote:<br>
>> >> Author: hhinnant<br>
>> >> Date: Thu Mar  7 13:38:08 2013<br>
>> >> New Revision: 176640<br>
>> >><br>
>> >> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=176640&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=176640&view=rev</a><br>
>> >> Log:<br>
>> >> Albert Wong: definition for regex_traits<_CharT>::__regex_word.<br>
>> >><br>
>> >> Modified:<br>
>> >>   libcxx/trunk/include/regex<br>
>> >><br>
>> >> Modified: libcxx/trunk/include/regex<br>
>> >> URL:<br>
>> >> <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=176640&r1=176639&r2=176640&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=176640&r1=176639&r2=176640&view=diff</a><br>


>> >><br>
>> >> ==============================================================================<br>
>> >> --- libcxx/trunk/include/regex (original)<br>
>> >> +++ libcxx/trunk/include/regex Thu Mar  7 13:38:08 2013<br>
>> >> @@ -1009,6 +1009,10 @@ private:<br>
>> >> };<br>
>> >><br>
>> >> template <class _CharT><br>
>> >> +const typename regex_traits<_CharT>::char_class_type<br>
>> >> +regex_traits<_CharT>::__regex_word;<br>
>> >> +<br>
>> >> +template <class _CharT><br>
>> >> regex_traits<_CharT>::regex_traits()<br>
>> >> {<br>
>> >>    __init();<br>
>> >><br>
>> >><br>
>> >> _______________________________________________<br>
>> >> cfe-commits mailing list<br>
>> >> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
>> >> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
>><br>
><br>
</div></div></blockquote></div><br></div></div>