RFR (S) JDK-8041620: Solaris Studio 12.4 C++ 5.13 change in behavior for placing friend declarations within surrounding scope
Lois Foltan
lois.foltan at oracle.com
Mon May 5 13:17:22 UTC 2014
Yes, that looks correct, thanks Volker for the example.
Lois
On 5/5/2014 8:18 AM, Volker Simonis wrote:
> On Sun, May 4, 2014 at 10:20 PM, David Holmes <david.holmes at oracle.com> wrote:
>> Hi Lois,
>>
>> Deletion of FileBuffRegion looks okay to me.
>>
>> Otherwise would the fix have been to change
>>
>> friend ostream& operator<< (ostream&, FileBuffRegion&);
>>
>> to
>>
>> friend ostream& ::std::operator<< (ostream&, FileBuffRegion&);
>>
> No, you would just have to declare:
>
> class FileBuffRegion;
> ostream& operator<< (ostream&, FileBuffRegion&);
>
> class FileBuffRegion {
> ...
> friend ostream& operator<< (ostream&, FileBuffRegion&);
> };
>
> right before the definition of the class FileBuffRegion where the
> operator is declared as a friend (as explained in
> http://docs.oracle.com/cd/E37069_01/html/E37075/gnyjb.html#OSSCPgnyly).
>
> The error just says that the compiler can not find a matching
> operator<< declaration in the enclosing scope of class FileBuffRegion
> and that the only operator<< declaration which it does find is not
> compatible with the one used in the friend declaration.
>
> Regards,
> Volker
>
>> ?
>>
>> Thanks,
>> David
>>
>>
>> On 5/05/2014 5:13 AM, Lois Foltan wrote:
>>> Hello,
>>>
>>> Please review the following fix:
>>>
>>> Webrev:
>>> http://cr.openjdk.java.net/~lfoltan/bug_jdk8041620/
>>>
>>> Bug: Solaris Studio 12.4 C++ 5.13 change in behavior for placing friend
>>> declarations within surrounding scope
>>> https://bugs.openjdk.java.net/browse/JDK-8041620
>>>
>>> Summary:
>>> Solaris Studio 12.4 C++ 5.13 compiler generates the following warning
>>> level compilation diagnostic for
>>> adlc/filebuff.hpp:
>>>
>>> "<directory>/src/share/vm/adlc/filebuff.hpp", line 107: Error:
>>> Unqualified name '<<' in friend declaration is looked up in the nearest
>>> enclosing namespace and does not refer to existing
>>> '::std::operator<<<_charT, _Traits>(basic_ostream<_charT, _Traits>&,
>>> _charT)'.
>>> 1 Error(s) detected.
>>>
>>> C++ 5.13 external beta documentation at
>>> http://docs.oracle.com/cd/E37069_01/html/E37075/gnyjb.html#OSSCPgnyly,
>>> details this change in behavior for friend declarations. Thank you to
>>> Christian Thalinger for pointing out that
>>> within filebuff.hpp, class FileBuffRegion is no longer used. Instead of
>>> fixing the friend declaration in unused code,
>>> removing FileBuffRegion.
>>>
>>> Tests:
>>> JPRT build & test, Hotspot's JTREG test system, vm.quick.testlist
More information about the hotspot-compiler-dev
mailing list