mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 18:46:40 +00:00

As reported in https://bugs.llvm.org/show_bug.cgi?id=33235, a noexcept function was unable to inherit from a nothrow defaulted constructor. Attribute "nothrow" is supposed to be semantically identical to noexcept, and in fact, a number of other places in the code treat them identically. This patch simply checks the RecordDecl for the correct attribute in the case where no other exception specifier was set. Differential Revision: https://reviews.llvm.org/D38209 llvm-svn: 314462
27 lines
484 B
C++
27 lines
484 B
C++
// RUN: %clang_cc1 %s -fcxx-exceptions -fsyntax-only -Wexceptions -verify -std=c++14
|
|
|
|
// expected-no-diagnostics
|
|
struct Base {
|
|
__attribute__((nothrow)) Base() {}
|
|
};
|
|
|
|
struct Derived : Base {
|
|
Derived() noexcept = default;
|
|
};
|
|
|
|
struct Base2 {
|
|
Base2() noexcept {}
|
|
};
|
|
|
|
struct Derived2 : Base2 {
|
|
__attribute__((nothrow)) Derived2() = default;
|
|
};
|
|
|
|
struct Base3 {
|
|
__attribute__((nothrow)) Base3() {}
|
|
};
|
|
|
|
struct Derived3 : Base3 {
|
|
__attribute__((nothrow)) Derived3() = default;
|
|
};
|