[Bug c++/41431] New: &main should be allowed within unevaluated operands.

schaub-johannes at web dot de gcc-bugzilla@gcc.gnu.org
Mon Sep 21 21:39:00 GMT 2009


The following code snippet is wrongly rejected

int main() { sizeof(&main); }

---
main.cpp: In function 'int main()':
main.cpp:1: warning: ISO C++ forbids taking address of function '::main'
---

But the Standard allows that within a sizeof, because according to 3.2/2 it
does not constitute a "use" of main.


-- 
           Summary: &main should be allowed within unevaluated operands.
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schaub-johannes at web dot de
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41431



More information about the Gcc-bugs mailing list