This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52725] error: "capture of non-variable" for new-expression incorrectly parsed as lambda-expression
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 25 May 2012 11:09:37 +0000
- Subject: [Bug c++/52725] error: "capture of non-variable" for new-expression incorrectly parsed as lambda-expression
- Auto-submitted: auto-generated
- References: <bug-52725-4@http.gcc.gnu.org/bugzilla/>
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];
}