C++ Logo

std-proposals

Advanced search

Re: Static Failure - Custom Compile-Time Errors

From: chuanqi.xcq <yedeng.yd_at_[hidden]>
Date: Fri, 18 Jun 2021 10:10:43 +0800
Hi David,

For the motivation example, it looks same for me to:
```
template<typename T> requires std::is_integral<T>
void my_func(T param) {
static_assert(std::is_same<T, uint8_t>() || std::is_same<T,int64_t>() ,”Compile Error! You passed an
int32_t into my_func !”);
}
```

It looks fine to me. So is the main motivation for static_failure for the situation in which the list of `if constexpr` is extrmely long?

Thanks,
Chuanqi


------------------------------------------------------------------
From:David Braun via Std-Proposals <std-proposals_at_[hidden]>
Send Time:2021年6月18日(星期五) 09:59
To:std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Cc:David Braun <da.braun1_at_[hidden]>
Subject:[std-proposals] Static Failure - Custom Compile-Time Errors


From: David Braun
Sent: Thursday, June 17, 2021 12:29 AM
To: lwgchair_at_[hidden]
Subject: C++ 23 Language Proposal for new type of static assertion
Here is my proposal for C++ 23.
Thank You!

David Aaron Braun
519-680-9822
226-236-4898
da.braun1_at_[hidden]

Received on 2021-06-17 21:10:48