[Bug c++/52725] error: "capture of non-variable" for new-expression incorrectly parsed as lambda-expression
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 25 11:30:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52725
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|error: capture of |error: "capture of
|non-variable (in regards to |non-variable" for
|a variable) |new-expression incorrectly
| |parsed as lambda-expression
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-25 11:09:37 UTC ---
N.B. I've changed the Summary, the "non-variable" in the diagnostic refers to a
non-automatic variable, in this case a data member, which isn't allowed in a
lamdba capture. The problem is not that the error says a member variable is a
non-variable, it's that a new-expression is mistaken for a lambda-expresion.
(In reply to comment #2)
> Hello, I have something similar in the OpenMM code
> (https://simtk.org/home/openmm), with no ()s following the "new" as in
Please provide a minimal, complete example, those snippets do not allow your
report to be reproduced or confirmed. This seems to be equivalent but works
fine:
template <typename T>
struct CUDAStream
{
unsigned int _subStreams;
T** _pSysStream;
void Allocate();
};
template <typename T>
void CUDAStream<T>::Allocate()
{
_pSysStream = new T*[_subStreams];
}
More information about the Gcc-bugs
mailing list