From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 771871F803 for ; Thu, 10 Jan 2019 20:08:43 +0000 (UTC) Received: from localhost ([127.0.0.1]:45151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghgd7-0000n9-T0 for normalperson@yhbt.net; Thu, 10 Jan 2019 15:08:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghgd3-0000mg-PV for bug-gnulib@gnu.org; Thu, 10 Jan 2019 15:08:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghgd1-0004M1-Sv for bug-gnulib@gnu.org; Thu, 10 Jan 2019 15:08:37 -0500 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::8]:29313) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghgcy-0004F3-VX for bug-gnulib@gnu.org; Thu, 10 Jan 2019 15:08:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1547150897; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=pl/BcRRZ7VmRQL+EWNMttWnL3Sb87bw24RVxXU6RWck=; b=oyu1vKzL2Oer/G267Xo8svUelDV2WruUtYeado5PmAYLcPBP9Yo5ibg+yhPdKwmyUT wkr4o3C73fWrLf8a/Jc2B81Dr1IkZeSQhP63JdH3L+FolnPqyCWtwrWAo9uO2zWAGNR+ SQWSoeH8pU7NkRg2jZvUFjS7eU+2NTTvhGO5zQ3wGBuQbu0U5PCxTZK0IFWTC4C+Zhjz wdZrGTiWXenF69gNPSOkNC83n2lytLNjA9C/GUpYkYlJophXrZIizU/Bxwu0Nb1eKP5o 0dam+Ik9lbvxDYlxzOvtnPvNrYdtMJ2FPp8JK+0wyz+JYMvvdlALNGV7xabkvU1zQfk1 XMcQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOGKf2y/s=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 44.9 DYNA|AUTH) with ESMTPSA id v0a34ev0AK8GagY (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 10 Jan 2019 21:08:16 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: static_assert in G++ Date: Thu, 10 Jan 2019 21:08:15 +0100 Message-ID: <1605725.3D5YJeabIe@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::8 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Reuben Thomas Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Hi Reuben, > verify: Fix syntax error with GCC 4.6 in C++ mode. > > This is odd, since the GCC web page on C++11 support: > https://gcc.gnu.org/projects/cxx-status.html#cxx11 > > says that static assertions have been supported for C++ since GCC 4.3: See the discussion on the mailing list: https://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00115.html Continuing with the next versions of g++: $ g++-version 4.3.6 -S foo1.cc foo1.cc:2: error: expected constructor, destructor, or type conversion before '(' token $ g++-version 4.4.7 -S foo1.cc foo1.cc:2: error: expected constructor, destructor, or type conversion before '(' token $ g++-version 4.5.4 -S foo1.cc foo1.cc:2:15: error: expected constructor, destructor, or type conversion before '(' token $ g++-version 4.6.4 -S foo1.cc foo1.cc:2:15: error: expected constructor, destructor, or type conversion before '(' token $ g++-version 4.7.3 -S foo1.cc foo1.cc:2:15: error: expected constructor, destructor, or type conversion before '(' token $ g++-version 4.8.5 -S foo1.cc foo1.cc:2:15: error: expected constructor, destructor, or type conversion before '(' token static_assert (sizeof (long) > 1, "long too small"); ^ $ g++-version 4.9.4 -S foo1.cc foo1.cc:2:15: error: expected constructor, destructor, or type conversion before '(' token static_assert (sizeof (long) > 1, "long too small"); ^ $ g++-version 5.5.0 -S foo1.cc foo1.cc:2:15: error: expected constructor, destructor, or type conversion before '(' token static_assert (sizeof (long) > 1, "long too small"); ^ $ g++-version 6.5.0 -S foo1.cc $ g++-version 7.4.0 -S foo1.cc $ g++-version 8.2.0 -S foo1.cc I'm therefore applying this patch: 2019-01-10 Bruno Haible verify: Enable _GL_HAVE_STATIC_ASSERT for recent G++ versions. Reported by Reuben Thomas . * lib/verify.h (_GL_HAVE_STATIC_ASSERT): Define for g++ versions >= 6. diff --git a/lib/verify.h b/lib/verify.h index b2e5f64..6930645 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -26,7 +26,7 @@ here generates easier-to-read diagnostics when verify (R) fails. Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11. - This will likely be supported by future GCC versions, in C++ mode. + This is supported by GCC 6.1.0 and later, in C++ mode. Use this only with GCC. If we were willing to slow 'configure' down we could also use it with other compilers, but since this @@ -36,9 +36,7 @@ && !defined __cplusplus) # define _GL_HAVE__STATIC_ASSERT 1 #endif -/* The condition (99 < __GNUC__) is temporary, until we know about the - first G++ release that supports static_assert. */ -#if (99 < __GNUC__) && defined __cplusplus +#if (6 <= __GNUC__) && defined __cplusplus # define _GL_HAVE_STATIC_ASSERT 1 #endif