[Bug c++/59937] [constexpr] bogus diagnostic "used in its own initializer"
jota.uve at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 14 12:52:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59937
--- Comment #4 from Javier V. Gómez <jota.uve at hotmail dot com> ---
(In reply to Jonathan Wakely from comment #3)
> (In reply to Javier V. Gómez from comment #2)
> > I found another case that worked in G++ 4.8.3 but fails in 4.9:
>
> This example is complete nonsense. Why is it split across three files? Why
> doesn't main.cpp include anything? Why is everything private? Why is 'a'
> undeclared in B::foo()? Why does the diagnostic talk about 'ndims' which
> isn't declared anywhere?
>
> It's useless as a test or an example of the error.
I tried to simplify as much as possible the issue, since I detected the error
in a big piece of code. I didn't pretend to create a compilable example. ndims
is what I called n (copy and paste...).
The important point of my example is that constexpr int n = a.getN(); fails
when A::getN() just returns a template parameter value previously set by a
constexpr anywhere else.
More information about the Gcc-bugs
mailing list