Issue 133392
Summary noexcept(constant-_expression_) accepts non contextually converted constant expressions
Labels new issue
Assignees
Reporter TymianekPL
    ```cpp
struct C
{
    constexpr explicit operator bool(void) { return false; }
};

void a(void) noexcept(C{})
{
}
```
This code will compile.

> In a *noexcept-specifier*, the constant-_expression_, if supplied, shall be a contextually converted constant _expression_ of type `bool` (7.7); that constant _expression_ is the exception specification of the function type in which the *noexcept-specifier* appears. A `(` token that follows `noexcept` is part of the noexcept-specifier and does not commence an initializer (9.4) The *noexcept-specifier* `noexcept` without a constant-_expression_ is equivalent to the *noexcept-specifier* `noexcept(true)`.
ISO/IEC N4950/14.5 [except.spec]

> A converted constant _expression_ of type `T` is an _expression_, implicitly converted to type `T`, where the converted _expression_ is a constant _expression_ and the implicit conversion sequence contains only
> [...]
> A *contextually converted constant _expression_* of type `bool` is an _expression_, contextually converted to `bool` (7.3), where the converted _expression_ is a constant _expression_ and the conversion sequence contains only the conversions above
ISO/IEC N4950/7.7 [expr.const]/12
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to