This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14586] New: [3.4/3.5 regression] Bogus warning in templates about taking address of a temporary


Here is a regression on 3.4 and 3.5 that breaks my nightly builds. 
Must be rather recent, i.e. in the last couple of days... 
 
----------------- 
enum E { e }; 
 
E & operator |= (E &f1, const E &f2); 
 
E operator | (const E &f1, const E &f2) { 
  E result = f1; 
  result |= f2; 
  return result; 
} 
 
template <typename> void foo () { 
  const E flags = e | e; 
} 
 
template void foo<double> (); 
------------------- 
 
deal.II/deal.II> /workspace/bangerth/build-gcc-3.4/gcc-install/bin/c++ -c x.cc 
x.cc: In function `void foo() [with number = double]': 
x.cc:19:   instantiated from here 
x.cc:16: warning: taking address of temporary 
x.cc:16: warning: taking address of temporary 
 
That's bogus. Beside, I'm a little annoyed that nobody ever came around 
to fix the doubled warning messages despite the fact that we have been 
seeing and reporting them for months. But that's another story. For now, 
the above thing breaks my -Werror builds. 
 
W.

-- 
           Summary: [3.4/3.5 regression] Bogus warning in templates about
                    taking address of a temporary
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14586


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]