My understanding was that static data members needed to be defined, even if they are integral types that are initialized with a constant expression with an exception being made if they are not "odr-used." (See [class.static.data]p3)
I don't 100% understand odr-used but I think __regex_word's usage in a non-const expression at line 1205 means this it needs to be defined and not just declared. As for making a test for this...it'd probably be difficult to write one that was guaranteed to fail. In the specific failure that prompted this, the MIPS g++ somehow ended up with an unresolved symbol. Oddly enough, the ARM and x86 variants of the same compiler version didn't do this. -Albert On Thu, Mar 7, 2013 at 11:56 AM, Howard Hinnant <[email protected]> wrote: > I don't have one. In order for me to detect this I would have to take the > address of __regex_word, and to the best I've been able to tell, on Apple > platforms libc++ never does this. However Albert Wong reported errors on > MIPS Android which this addition fixed. I did run the regex tests on OS X > before and after this addition and they all passed. I view this addition > as benign on Apple platforms, and happy to help out on MIPS Android. > > Howard > > On Mar 7, 2013, at 2:47 PM, David Blaikie <[email protected]> wrote: > > > Is there a test case to go with this? > > > > On Thu, Mar 7, 2013 at 11:38 AM, Howard Hinnant <[email protected]> > wrote: > >> Author: hhinnant > >> Date: Thu Mar 7 13:38:08 2013 > >> New Revision: 176640 > >> > >> URL: http://llvm.org/viewvc/llvm-project?rev=176640&view=rev > >> Log: > >> Albert Wong: definition for regex_traits<_CharT>::__regex_word. > >> > >> Modified: > >> libcxx/trunk/include/regex > >> > >> Modified: libcxx/trunk/include/regex > >> URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=176640&r1=176639&r2=176640&view=diff > >> > ============================================================================== > >> --- libcxx/trunk/include/regex (original) > >> +++ libcxx/trunk/include/regex Thu Mar 7 13:38:08 2013 > >> @@ -1009,6 +1009,10 @@ private: > >> }; > >> > >> template <class _CharT> > >> +const typename regex_traits<_CharT>::char_class_type > >> +regex_traits<_CharT>::__regex_word; > >> + > >> +template <class _CharT> > >> regex_traits<_CharT>::regex_traits() > >> { > >> __init(); > >> > >> > >> _______________________________________________ > >> cfe-commits mailing list > >> [email protected] > >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
