Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/andreasfertig/programming-with-cpp20
/ Fun
Function
Fun
12.05-throwAtCompileTime0/main.cpp:4–9 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
2
// SPDX-License-Identifier: MIT
3
4
constexpr bool Fun(bool b)
5
{
6
if(b) { throw int{42}; }
7
8
return true;
9
}
10
11
static_assert(Fun(false)); // #A OK
12
// static_assert(Fun(true)); // #B Leads to compile error due to throw
Callers
1
main.cpp
File · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected