From patchwork Tue Oct 16 19:59:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ville Voutilainen X-Patchwork-Id: 985012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487691-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="TNn518RP"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="emmH8PcC"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42ZR4F4mFQz9s2P for ; Wed, 17 Oct 2018 07:00:11 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=WKVNUXjUZxw5ulWOmdwqQPaUKs5zg3zR6F219BqHFluKP/ FTrH8oEPqIk4KVk8EtuGrrnHFLmQvIExSZbnxRAGYpWukam3aoaQaBaQ1uxkQjyt /ZEnF7mRr9jFfl0P+ryxZE1pkhG3gUQtGBkJmzk+ClgkGi4SNUl8mcM3yJ+U4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=FDtoGkvTokt504iVDXY395KGA6Y=; b=TNn518RPTzJBKJnJLX1n qQZaZzB+lzG7U2x5F46kTuKkgfJjVEYP5GyCGx/dUaaT3uxQFpWkmDDps7ElfcsE yQ7btH6cFHu+eVGwP1muk3j0YpZJeJRfusmVf1irdAN9ACSEAYO9Ae66fm2VEkmk Vns4W3b9U3dxd3HgA6Xik1E= Received: (qmail 58359 invoked by alias); 16 Oct 2018 19:59:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 58330 invoked by uid 89); 16 Oct 2018 19:59:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=sweet X-HELO: mail-ot1-f50.google.com Received: from mail-ot1-f50.google.com (HELO mail-ot1-f50.google.com) (209.85.210.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Oct 2018 19:59:53 +0000 Received: by mail-ot1-f50.google.com with SMTP id 14so19838982oth.2; Tue, 16 Oct 2018 12:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=ldN5gzoicx/NZLk+ooASEQYKERRWDAiNW/iRso8VdX0=; b=emmH8PcCLjkSA+G69ccFj1vTzbidLY9PtITV0Lmy6awuFJBkG7HET88fck5B4hsXLy Y/iApVX8YFpm8VpU5XleiU/zkleArpRYW52aUwMAo6haStPiRR/ATczm+Uxg1lqkmlDG oAAuXAf5PBjZADUmw4r3kLrMzS0TKjS2bzy0dkWCLwiuB/Ygq0yozDcqbUnCsu8aacAb oBD9NwdLXeGsaY4HFxaV1VRhDVuz68pOryeekoeno7lGlbtgQmeiw4gwB4yZqt2CQQHO bsmk27UnXQtbkBVPanFFDcoZMW9iqDv0C4152OK8rLEIf2hOVHEFO+y7C9VeH40+h9GJ Lacw== MIME-Version: 1.0 From: Ville Voutilainen Date: Tue, 16 Oct 2018 22:59:39 +0300 Message-ID: Subject: [v3 PATCH] PR libstdc++/87619 To: gcc-patches List , "libstdc++" Simple, short, and sweet, just a thinko. 2018-10-16 Ville Voutilainen PR libstdc++/87619 * include/std/variant (__select_index): Fix an off-by-one. * testsuite/20_util/variant/87619.cc: New. diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 2d86a70..55b6440 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -362,7 +362,7 @@ namespace __variant template using __select_index = - typename __select_int::_Select_int_base::type::value_type; diff --git a/libstdc++-v3/testsuite/20_util/variant/87619.cc b/libstdc++-v3/testsuite/20_util/variant/87619.cc new file mode 100644 index 0000000..a8db6b8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/variant/87619.cc @@ -0,0 +1,46 @@ +// Copyright (C) 2018 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++17" } +// { dg-do compile { target c++17 } } + +#include +#include + + +template +struct S { +}; + +template +void f_impl(std::index_sequence) +{ + using V = std::variant...>; + static_assert(sizeof(V) == 2); +} + +template +void f() +{ + f_impl(std::make_index_sequence{}); +} + +int main() +{ + f<254>(); + f<255>(); +}