Bug 58131

Summary: Fix compilation with Solaris 10/Sun Studio 12: moving elements in a vector requires source not to be const
Product: WebKit Reporter: Ben Taylor <bentaylor.solx86>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Other   
Attachments:
Description Flags
Fixing a compile issue on Solaris 10 with Sun Studio 12 C++, fix a modified src parameter to not be const
none
Updated patch per recommendation of reviewer. This makes it very clear why we fix what we do. none

Description Ben Taylor 2011-04-08 03:19:11 PDT
I don't know why the compiler couldn't call src->~T() on a const T *src,
but fact is it couldn't.

In any case, since move is copying the source and deleting it, formally
the argument shouldn't be const anyway.
Comment 1 Ben Taylor 2011-04-08 04:52:27 PDT
Created attachment 88801 [details]
Fixing a compile issue on Solaris 10 with Sun Studio 12 C++, fix a modified src parameter to not be const

Patch to fix the compile issue on Solaris 10 with Sun Studio 12, originally created by
Thiago Macieria as part of patch11/17 from bug https://bugs.webkit.org/show_bug.cgi?id=24932
Comment 2 Alexey Proskuryakov 2011-04-08 11:41:30 PDT
+        Fix compile issue on Solaris 10/Sun Studio 12, since the move is copying 
+        the source and deleting it, formally the argument shouldn't be const anyway.

This is a questionable explanation. The ability to delete an object via a const pointer is a normal C++ behavior, and playing against C++ is not safe. Wouldn't it be better to do a const_cast when destructing as a workaround?

Besides, if src should be non-const, why doesn't the same apply to srcEnd?
Comment 3 Ben Taylor 2011-04-12 19:38:31 PDT
Created attachment 89328 [details]
Updated patch per recommendation of reviewer. This makes it very clear why we fix what we do.

This patch is to work around an obscure compiler bug in Sun Studio 12 (fixed in SS12.1 and SS12.2) where the compiler couldn't call src->~T() on a const T *src
Comment 4 Alexey Proskuryakov 2011-04-12 21:35:55 PDT
Comment on attachment 89328 [details]
Updated patch per recommendation of reviewer. This makes it very clear why we fix what we do.

Do you know how long we'll have to support these old versions of the compiler? Why are they still important?
Comment 5 WebKit Commit Bot 2011-04-12 23:45:48 PDT
Comment on attachment 89328 [details]
Updated patch per recommendation of reviewer. This makes it very clear why we fix what we do.

Clearing flags on attachment: 89328

Committed r83704: <http://trac.webkit.org/changeset/83704>
Comment 6 WebKit Commit Bot 2011-04-12 23:45:54 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Ben Taylor 2011-04-13 03:07:14 PDT
(In reply to comment #4)
> (From update of attachment 89328 [details])
> Do you know how long we'll have to support these old versions of the compiler? Why are they still important?

SS12 is important as it can still build QT/webkit on Solaris 10.  SS12.1/12.2 is a new compiler engine, and specificially SS12.2 has bugs that *fail* the compiler with an internal error.  Additionally, Even if that bug is fixed, you have to now have a support contract to get the fix.