220 33532 <d58143f8-c128-3745-b835-1e04a5760d0d@gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Catch block for multiple exceptions
Date: Wed, 2 Aug 2017 09:38:26 -0400
Lines: 29
Approved: news@gmane.org
Message-ID: <d58143f8-c128-3745-b835-1e04a5760d0d@gmail.com>
References: <effe744d-f832-42c7-9b2a-ef31551067d0@isocpp.org>
 <deaedeb0-a699-49e9-826a-c41e674902c0@isocpp.org>
 <CAEfefmzCWDwP2ha7UfvvPrW_56TT4DEgvwRyxWm=6gS_GZc7pA@mail.gmail.com>
 <4126837.jZlGhgVnua@tjmaciei-mobl1>
 <d14636de-fb57-47b3-8666-7976ccdb6fe8@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1501681114 751 195.159.176.226 (2 Aug 2017 13:38:34 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 2 Aug 2017 13:38:34 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.2.1
To: std-proposals@isocpp.org, Barry Revzin <barry.revzin@gmail.com>
Original-X-From: std-proposals+bncBC37LBFWUIFBBVNLQ7GAKGQEGAFM6HY@isocpp.org Wed Aug 02 15:38:30 2017
Return-path: <std-proposals+bncBC37LBFWUIFBBVNLQ7GAKGQEGAFM6HY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f197.google.com ([209.85.220.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC37LBFWUIFBBVNLQ7GAKGQEGAFM6HY@isocpp.org>)
	id 1dctr3-00088J-Kl
	for gclcip-std-proposals@m.gmane.org; Wed, 02 Aug 2017 15:38:29 +0200
Original-Received: by mail-qk0-f197.google.com with SMTP id c2sf22028863qkb.10
        for <gclcip-std-proposals@m.gmane.org>; Wed, 02 Aug 2017 06:38:30 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1501681110; cv=pass;
        d=google.com; s=arc-20160816;
        b=ASYxGRrWcLW9DnDDp9r0sODa6Gy7ELYzSg137GFX9YhT2aaiKWVQ1cpEjjvMIp2ixi
         mHhIbur6LMczFW1x2vnxxj/0ITbBe7K2AqxTKD6Pgj97O/6nz2M22fEjSNg8tYEyawx+
         Ne1RKXf/uKSts/85dZBBv5Vj1J2zkgu6sCpYwBMpU3UI93v1a/vFd6JgXI6guYzMRLZG
         BLqStZm6l3PiSgTqxBvFbV9Hz/irN8EdJ0euguHWz49VH5ZE0bNuqORIZs+nI36qa36b
         OphCOWvoQzma3H/iD3VVXsBAB0nPeq635sL5/Sz/d+kGLx4r9lg6D9vznO/YKhVAzEe0
         +Btg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-language
         :in-reply-to:mime-version:user-agent:date:message-id:from:references
         :newsgroups:to:subject:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=BG1wLXCAn89659aezuUKBvTAVBicnsNYWitbK5AzVoI=;
        b=XEm9rN3EZ5FQ6Hb9whhsv449mYx2Lm42M1Flgv1Vzc0O531wfTAdSd7zPZ8Q2oCG+3
         Eu+e8WR9ZktyPJPM7wBtyiCk/qzWSCFbd8RoM+MLIphs63J8hNHBI/0DXoVSz9YrfUwE
         Qbt7/VqPuFm2flZWGfkkxioGMEiT4TfWtVlETVgI9fAhGabpFQ/jik1JVYtlMd63a8kW
         +v+Lnut8z/r5QaYkLKCup2Pfq2Dqkg1IinXO7XAjs2DIRtRqfsopUqwDGgQZSETlMlnc
         4oQpT2KUeTKHZL4uM4ukAw2xKpYpGVFs8HbFP9mWQxTJxpMcdvcK62y+JmqjQgiilAGk
         
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.b=hI9smtNW;
       spf=pass (google.com: domain of mwoehlke.floss@gmail.com designates 2607:f8b0:400d:c0d::233 as permitted sender) smtp.mailfrom=mwoehlke.floss@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:newsgroups:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-language:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=BG1wLXCAn89659aezuUKBvTAVBicnsNYWitbK5AzVoI=;
        b=G3NBlmr8CyWiGQTPhcVT4CD8/8R2nuxmtYAUcxJtRmttmxb1ym6wdy143e2UJ8rySg
         87hD0Sf6vZWkzwEbK+3bcOCpjWk4MDMlVCy1CpQ88pEDURENXt3ibIeDX8/tUEvPtaMk
         YAq3Zo6ZzytQ6mo2RQWTx3/1M4xH8MWYjrPhKV5SxePqywhzk/Cr2KlP2ZnNNSCYw3+H
         4baeqL7+zKEUNiwCaMcLxk6tt6hLqRamSQKLA0feqTmdoVDvogcME085ROhHt/VmAzuP
         Xr5BLNH4AfPfxXOX/8hmHQVDLRfSKwG1C7BIRCe9BOmcJVtrmjkLTTJaULCU5oG8LEvI
         EYXQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:newsgroups:references:from:message-id
         :date:user-agent:mime-version:in-reply-to:content-language
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=BG1wLXCAn89659aezuUKBvTAVBicnsNYWitbK5AzVoI=;
        b=cE7HbaYbjJsBActLxYU5P5BxxStI3ZjNOZcOavtRm7zdrBCrvhxA58Ab6oUGT7iqfa
         PZDYeKRNMJmpvgFTnsTKEvDsh88bOSoBTFheDPdJgsRJr93Ix/+fn+jQpj0dEI/IUHyG
         vE9FNvuBlXTxdi1168xJbe2XBsi6W6tZ7jAkn+FZFiytFwy+/7bvBIDDvgPTz/Y4Awvn
         twsFJD8LhHD2VXq4Fk/0I1XBAVbFJTkew6piFHJOEdBa1fr8tyBS+cQ81IYCnhZpkcDn
         JKUul+RbLG7+6f6Sbpuy/GUY2uuRnVA7Ya4/qg7YKmelLCkzxCLcQ0AyCBNvaHuOIL71 
X-Gm-Message-State: AIVw111dDtO8A1V56dRFoL5RQ46gY1+VRzvc3NnHM5uOpg2rw7wVrwNY
	ujkQ2DfQ44xUzHZ5
X-Received: by 10.200.46.149 with SMTP id h21mr3604994qta.63.1501681110197;
        Wed, 02 Aug 2017 06:38:30 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.69.222 with SMTP id c91ls3090044itd.0.canary-gmail; Wed, 02
 Aug 2017 06:38:28 -0700 (PDT)
X-Received: by 10.200.0.65 with SMTP id i1mr33363977qtg.193.1501681108914;
        Wed, 02 Aug 2017 06:38:28 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1501681108; cv=none;
        d=google.com; s=arc-20160816;
        b=ZNhpX4FoJFU/shb7xxALhAiU1d6iWI/Rk0GCawCYjpFSzf7z3G8yFScSrQxgRnA+QL
         W46GVWx6s8r3PHEC7JEkIBukDPGwcISLZvt/EEQ5vXYRN767f7YZZxvZvRt5+8VfeDY0
         SRLzPajQO00u/RNNQ78e1IxEFOV7uvp5Ey1StQxmzxQmcJ08o5IQ7vtccxx2vai8mXvO
         8r6Sl/DXbeUebib+Y79bZPGknmI3xWlt8BN2R1K9edmBdv6CRLIeUFDm2cgEFkHNiDh3
         OlUQ/9LT05SiNLB/AhnQ+FXXG1rNzXskJLgwxiDWNGfKXp6Ute1tDrnu6QhcnIEGCbzO
         7DaQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:from:references:newsgroups:to:subject
         :dkim-signature:arc-authentication-results;
        bh=NKbmUmT4EcVbzW/0AmzZfh4uDhwlBllLdLwtms9FSx4=;
        b=D7eGjld7NS/bK/3dZKz3DsRkwL7t8M+Dj3/9gCOnpk7rA8xJq7HnvHl29FhTnQ62ZJ
         CmIkDoxw+JumcVrqgcdkIYQhYEZlbhLz8VBKbo8Q9tNbhH/p7RvdHxfQmo05eFDkucHg
         tQbcOqoeP14Yuq6exb8DCTBUX+BbXOHIdGb7sTT4B4pZlFg8nCZJorxh5Fr9q5y175o6
         yR1htkCCiOH3cfbV8axvaJNy5E6BJBpOh4dzW027eGzItag6MTevOVahd9DY8pPEsZfK
         SWs4yQTVl1bu8CtOijPxf4RpNllYtOSuX90xFG5DWOJvruXLRwLDlKPvj5kLp05fnXVw
         NvUg==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.b=hI9smtNW;
       spf=pass (google.com: domain of mwoehlke.floss@gmail.com designates 2607:f8b0:400d:c0d::233 as permitted sender) smtp.mailfrom=mwoehlke.floss@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-qt0-x233.google.com (mail-qt0-x233.google.com. [2607:f8b0:400d:c0d::233])
        by mx.google.com with ESMTPS id g3si11763564qtd.209.2017.08.02.06.38.28
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 02 Aug 2017 06:38:28 -0700 (PDT)
Received-SPF: pass (google.com: domain of mwoehlke.floss@gmail.com designates 2607:f8b0:400d:c0d::233 as permitted sender) client-ip=2607:f8b0:400d:c0d::233;
Original-Received: by mail-qt0-x233.google.com with SMTP id s6so27014034qtc.1
        for <std-proposals@isocpp.org>; Wed, 02 Aug 2017 06:38:28 -0700 (PDT)
X-Received: by 10.200.3.43 with SMTP id q43mr33771616qtg.274.1501681108606;
        Wed, 02 Aug 2017 06:38:28 -0700 (PDT)
Original-Received: from gryphon.kitware.com (tripoint.kitware.com. [66.194.253.20])
        by smtp.googlemail.com with ESMTPSA id o20sm25625456qtc.23.2017.08.02.06.38.27
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 02 Aug 2017 06:38:27 -0700 (PDT)
Original-Newsgroups: gmane.comp.lang.c++.isocpp.proposals
In-Reply-To: <d14636de-fb57-47b3-8666-7976ccdb6fe8@isocpp.org>
Content-Language: en-US
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.b=hI9smtNW;       spf=pass (google.com: domain of
 mwoehlke.floss@gmail.com designates 2607:f8b0:400d:c0d::233 as permitted
 sender) smtp.mailfrom=mwoehlke.floss@gmail.com;       dmarc=pass (p=NONE
 sp=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:33532
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33532>

On 2017-08-02 08:47, Barry Revzin wrote:
>> And how to know which one invoked? You don't. If you wanted to know if it 
>> was exceptionA, you'd add a catch block for it.  
> 
> You'd almost want something like:
> 
> catch (variant<exceptionA&, exceptionB&, exceptionC&> e) {
>     visit([](auto& e){ f(e); }, e);
> }

  catch (exceptionA, exceptionB, exceptionC e) {
    if constexpr (std::is_same_type_t<decltype(e), exceptionA>) {
      ...do something with exceptionA...
    }
  }

IOW, implement such blocks sort of like templates; write the code once,
but the compiler internally converts it to separate catch-blocks with
the same bodies.

-- 
Matthew

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d58143f8-c128-3745-b835-1e04a5760d0d%40gmail.com.

.
