<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic aCC emits warning about return value variable being set but not used in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/acc-emits-warning-about-return-value-variable-being-set-but-not/m-p/6843758#M494880</link>
    <description>&lt;P&gt;I have found an issue in aCC. &amp;nbsp;I am using version:&lt;BR /&gt;aCC: HP C/aC++ B3910B A.06.28.01 [Aug 09 2014]&lt;/P&gt;&lt;P&gt;Given this test case&lt;/P&gt;&lt;PRE&gt;class B
{
public:
struct A
{
  A():
    a_(0)
  {};

  void* a_;
};

};

class F
{
public:
B::A
getA()
{
  B::A ret;
  return ret;
}
};


B::A get()
{
  F f;
  B::A theA = f.getA();
  
  return theA;
}&lt;/PRE&gt;&lt;P&gt;compiled with this call:&lt;/P&gt;&lt;PRE&gt;aCC +DD64 +w +std=c++11  -c t.cpp&lt;/PRE&gt;&lt;P&gt;I see the following warning emitted&lt;/P&gt;&lt;PRE&gt;"t.cpp", line 30: remark #2550-D: variable "theA" was set but never used
    B::A theA = f.getA();&lt;/PRE&gt;&lt;P&gt;However because "theA" is the return value it is legal for it to be set but not used. &amp;nbsp;I feel this warning is an error on the compilers part.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Mar 2016 17:43:38 GMT</pubDate>
    <dc:creator>dritter29</dc:creator>
    <dc:date>2016-03-21T17:43:38Z</dc:date>
    <item>
      <title>aCC emits warning about return value variable being set but not used</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/acc-emits-warning-about-return-value-variable-being-set-but-not/m-p/6843758#M494880</link>
      <description>&lt;P&gt;I have found an issue in aCC. &amp;nbsp;I am using version:&lt;BR /&gt;aCC: HP C/aC++ B3910B A.06.28.01 [Aug 09 2014]&lt;/P&gt;&lt;P&gt;Given this test case&lt;/P&gt;&lt;PRE&gt;class B
{
public:
struct A
{
  A():
    a_(0)
  {};

  void* a_;
};

};

class F
{
public:
B::A
getA()
{
  B::A ret;
  return ret;
}
};


B::A get()
{
  F f;
  B::A theA = f.getA();
  
  return theA;
}&lt;/PRE&gt;&lt;P&gt;compiled with this call:&lt;/P&gt;&lt;PRE&gt;aCC +DD64 +w +std=c++11  -c t.cpp&lt;/PRE&gt;&lt;P&gt;I see the following warning emitted&lt;/P&gt;&lt;PRE&gt;"t.cpp", line 30: remark #2550-D: variable "theA" was set but never used
    B::A theA = f.getA();&lt;/PRE&gt;&lt;P&gt;However because "theA" is the return value it is legal for it to be set but not used. &amp;nbsp;I feel this warning is an error on the compilers part.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 17:43:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/acc-emits-warning-about-return-value-variable-being-set-but-not/m-p/6843758#M494880</guid>
      <dc:creator>dritter29</dc:creator>
      <dc:date>2016-03-21T17:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: aCC emits renark about return value variable being set but not used</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/acc-emits-warning-about-return-value-variable-being-set-but-not/m-p/6845340#M494881</link>
      <description>&lt;P&gt;&amp;gt;"theA" is the return value it is legal for it to be set but not used. &amp;nbsp;I feel this warning is an error on the compilers part.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(This has nothing to do with "legal" but with coding style.)&lt;/P&gt;&lt;P&gt;Looks like a minor bug to me but you asked for it by using +w.&amp;nbsp; :-)&lt;/P&gt;&lt;P&gt;I only see it with +w and +std=c++11, not sure the connection.&lt;/P&gt;&lt;P&gt;And if it was due to the NRV optimization, that should do the warning check before the optimization and +nonrv didn't turn it off.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 26 Mar 2016 08:15:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/acc-emits-warning-about-return-value-variable-being-set-but-not/m-p/6845340#M494881</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2016-03-26T08:15:58Z</dc:date>
    </item>
  </channel>
</rss>

