diff options
Diffstat (limited to 'clang/test/SemaCXX/constant-expression-cxx1y.cpp')
-rw-r--r-- | clang/test/SemaCXX/constant-expression-cxx1y.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constant-expression-cxx1y.cpp b/clang/test/SemaCXX/constant-expression-cxx1y.cpp index fe69d105023..6a344c8d4a5 100644 --- a/clang/test/SemaCXX/constant-expression-cxx1y.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx1y.cpp @@ -1205,3 +1205,19 @@ namespace ObjectsUnderConstruction { // The lifetime of 'n' begins at the initialization, not before. constexpr int n = ++const_cast<int&>(n); // expected-error {{constant expression}} expected-note {{modification}} } + +namespace PR39728 { + struct Comment0 { + Comment0 &operator=(const Comment0 &) = default; + ~Comment0() = default; + }; + constexpr void f() { + Comment0 a; + a = a; + } + static_assert((f(), true), ""); + struct Comment1 { + constexpr Comment1 &operator=(const Comment1 &) = default; // OK + ~Comment1() = default; + }; +} |