]> granicus.if.org Git - clang/commitdiff
Tests for DR1507.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 18 Oct 2012 00:44:17 +0000 (00:44 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 18 Oct 2012 00:44:17 +0000 (00:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166162 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaInit.cpp
test/CXX/dcl.decl/dcl.init/p7.cpp [new file with mode: 0644]

index 7f3d7ab3599eb7aea0dfeb015b1208ba87e33f27..ec25d531136f9de184ba065d9388450d12a4cb65 100644 (file)
@@ -3611,7 +3611,8 @@ static void TryValueInitialization(Sema &S,
       //    user-provided or deleted default constructor, then the object is
       //    zero-initialized and, if T has a non-trivial default constructor,
       //    default-initialized;
-      // The 'non-union' here was removed by DR1502.
+      // The 'non-union' here was removed by DR1502. The 'non-trivial default
+      // constructor' part was removed by DR1507.
       if (NeedZeroInitialization)
         Sequence.AddZeroInitializationStep(Entity.getType());
 
diff --git a/test/CXX/dcl.decl/dcl.init/p7.cpp b/test/CXX/dcl.decl/dcl.init/p7.cpp
new file mode 100644 (file)
index 0000000..03216f4
--- /dev/null
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s
+
+struct NotAggregateBase {};
+
+struct A : NotAggregateBase {
+private:
+  A() = default; // expected-note {{here}}
+};
+A a = {}; // expected-error {{calling a private constructor}}
+
+struct B : NotAggregateBase {
+  explicit B() = default; // expected-note {{here}}
+};
+B b = {}; // expected-error {{chosen constructor is explicit}}