From owner-svn-src-head@FreeBSD.ORG Thu Dec 29 14:41:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84154106566B; Thu, 29 Dec 2011 14:41:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72BD58FC08; Thu, 29 Dec 2011 14:41:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBTEfIAZ060129; Thu, 29 Dec 2011 14:41:18 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBTEfI8l060127; Thu, 29 Dec 2011 14:41:18 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112291441.pBTEfI8l060127@svn.freebsd.org> From: Ed Schouten Date: Thu, 29 Dec 2011 14:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228955 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2011 14:41:18 -0000 Author: ed Date: Thu Dec 29 14:41:17 2011 New Revision: 228955 URL: http://svn.freebsd.org/changeset/base/228955 Log: Don't define static_assert for C++. Even though _Static_assert() is pretty robust for C code, it cannot work correctly with C++ code. This is due to the fact that C++ template parameters may contain commas that are not enclosed in parentheses. For example: static_assert(foo::bar == baz, "..."); This causes _Static_assert to be called with an excessive number of parameters. If you want to use static_assert in C++, just use a C++11 compiler. Reported on: current@, ports@ Modified: head/include/assert.h Modified: head/include/assert.h ============================================================================== --- head/include/assert.h Thu Dec 29 12:33:41 2011 (r228954) +++ head/include/assert.h Thu Dec 29 14:41:17 2011 (r228955) @@ -58,7 +58,16 @@ #ifndef _ASSERT_H_ #define _ASSERT_H_ -#if __ISO_C_VISIBLE >= 2011 && (!defined(__cplusplus) || __cplusplus < 201103L) +/* + * Static assertions. In principle we could define static_assert for + * C++ older than C++11, but this breaks if _Static_assert is + * implemented as a macro. + * + * C++ template parameters may contain commas, even if not enclosed in + * parentheses, causing the _Static_assert macro to be invoked with more + * than two parameters. + */ +#if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus) #define static_assert _Static_assert #endif