From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31014 invoked by alias); 1 Sep 2013 05:33:27 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 30993 invoked by uid 48); 1 Sep 2013 05:33:24 -0000 From: "jklowden at schemamania dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/58289] New: gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs Date: Sun, 01 Sep 2013 05:33:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jklowden at schemamania dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-09/txt/msg00000.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58289 Bug ID: 58289 Summary: gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: jklowden at schemamania dot org I pulled from svn://gcc.gnu.org/svn/gcc/trunk today to build gcc on OS X using Clang. Some header files use C++ syntax, but are included in C files. The error I'm seeing is: /Developer/usr/bin/clang [...options omitted...] -o build/gengtype.o ../../gcc/gengtype.c [...warnings ommitted...] In file included from ../../gcc/gengtype.c:28: ../../gcc/double-int.h:58:10: error: must use 'struct' tag to refer to type 'double_int' static double_int from_uhwi (unsigned HOST_WIDE_INT cst); The error stems from this construct in double-int.h: ==snip== struct double_int { /* Normally, we would define constructors to create instances. Two things prevent us from doing so. First, defining a constructor makes the class non-POD in C++03, and we certainly want double_int to be a POD. Second, the GCC conding conventions prefer explicit conversion, and explicit conversion operators are not available until C++11. */ static double_int from_uhwi (unsigned HOST_WIDE_INT cst); ==pins== Comment not withstanding, the file could easily be converted to C; there are no classes declared, for instance. All that's needed is say, static struct double-int from_uhwi = cst; perhaps with a cast. I found similar problems in two other files that were small enough to repair or work around. This file seems to be a pupa determined to become C++, and I'm not quite sure what should be done.