This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/38354] Spurious error: initializer element is not computable at load time
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 08 Sep 2014 23:22:47 +0000
- Subject: [Bug c/38354] Spurious error: initializer element is not computable at load time
- Auto-submitted: auto-generated
- References: <bug-38354-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38354
--- Comment #7 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Mon, 8 Sep 2014, adam at consulting dot net.nz wrote:
> 3. To demonstrate this, a GNU extension to C++ has no problem computing the
> address of the function pointer at load time and storing it in a 32-bit integer
> array.
Standard C++ allows static initializers that can only be computed at
runtime; there's no such thing as an initializer being invalid for C++
because it's non-constant. Thus, it's not significant that this code is
accepted for C++; quite likely the initializers get computed at runtime in
the C++ case.