[llvm-bugs] [Bug 51765] New: The exception specification of a deallocation function that is not explicitly specified is non-throwing

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 6 01:47:19 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51765

            Bug ID: 51765
           Summary: The exception specification of a deallocation function
                    that is not explicitly specified is non-throwing
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xmh970252187 at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

#include <iostream>
void operator delete(void*){}  // #1
int main(){

}

Clang rejects this example, whilst giving an error 

> function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Werror,-Wimplicit-exception-spec-mismatch]

However, according to [except.spec#10]

> A deallocation function with no explicit noexcept-specifier has a non-throwing exception specification.

That means the signature of the declaration at `#1` is identical to `void
operator delete(void*) noexcept` 

[new.delete.single] permits that  

> void operator delete(void* ptr) noexcept;
> Replaceable: A C++ program may define functions with any of these function signatures, and thereby displace the default versions defined by the C++ standard library.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210906/20c72f31/attachment.html>


More information about the llvm-bugs mailing list