c++/9259: Error on initialization of static member variable with sizeof(function_call())

bangerth@ticam.utexas.edu bangerth@ticam.utexas.edu
Fri Jan 10 14:56:00 GMT 2003


>Number:         9259
>Category:       c++
>Synopsis:       Error on initialization of static member variable with sizeof(function_call())
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 10 06:56:03 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
since at least 2.95 and up to present 3.4
>Description:
This surprisingly simple piece of code (modified from 
BOOST) does not (and did never with any version of gcc)
compile:
------------------------------
struct S 
{
    static int check ();
    static const int value = sizeof(check());
};
------------------------------

tmp/g> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c h.cc
h.cc:4: error: invalid use of undefined type `struct S'
h.cc:2: error: forward declaration of `struct S'

Volker (with help by Comeau's and SGI's compilers) and icc 
also agree that this should compile.

W.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list