]> granicus.if.org Git - clang/commitdiff
Add { } to silence compiler warning [NFC]
authorMikael Holmen <mikael.holmen@ericsson.com>
Thu, 11 Apr 2019 06:57:12 +0000 (06:57 +0000)
committerMikael Holmen <mikael.holmen@ericsson.com>
Thu, 11 Apr 2019 06:57:12 +0000 (06:57 +0000)
At least clang 3.6 warns on the original code:

../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:829:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 1>({Address(nullptr, CharUnits::Zero())});
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 {                                  }
../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:833:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 2>({Address(nullptr, CharUnits::Zero()),
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358152 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGNonTrivialStruct.cpp

index bc34727731d623b25cb5a31c079a2c148ffde05e..caf62d2ac93a1db73b12f0301dc8c5b67ddfb076 100644 (file)
@@ -826,12 +826,12 @@ static void callSpecialFunction(G &&Gen, StringRef FuncName, QualType QT,
 template <size_t N> std::array<Address, N> createNullAddressArray();
 
 template <> std::array<Address, 1> createNullAddressArray() {
-  return std::array<Address, 1>({Address(nullptr, CharUnits::Zero())});
+  return std::array<Address, 1>({{Address(nullptr, CharUnits::Zero())}});
 }
 
 template <> std::array<Address, 2> createNullAddressArray() {
-  return std::array<Address, 2>({Address(nullptr, CharUnits::Zero()),
-                                 Address(nullptr, CharUnits::Zero())});
+  return std::array<Address, 2>({{Address(nullptr, CharUnits::Zero()),
+                                  Address(nullptr, CharUnits::Zero())}});
 }
 
 template <class G, size_t N>