[all-commits] [llvm/llvm-project] 64c24f: Remove warning "suggest braces" for aggregate init...

Hana Dusíková via All-commits all-commits at lists.llvm.org
Tue Apr 13 12:47:24 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 64c24f493e5f4637ee193f10f469cdd2695b4ba6
      https://github.com/llvm/llvm-project/commit/64c24f493e5f4637ee193f10f469cdd2695b4ba6
  Author: Hana Dusíková <hanicka at hanicka.net>
  Date:   2021-04-13 (Tue, 13 Apr 2021)

  Changed paths:
    M clang/lib/Sema/SemaInit.cpp
    M clang/test/SemaCXX/aggregate-initialization.cpp

  Log Message:
  -----------
  Remove warning "suggest braces" for aggregate initialization of an empty class with an aggregate base class.

I recently ran into issues with aggregates and inheritance, I'm using
it for creating a type-safe library where most of the types are build
over "tagged" std::array. After bit of cleaning and enabling -Wall
-Wextra -pedantic I noticed clang only in my pipeline gives me warning.
After a bit of focusing on it I found it's not helpful, and contemplate
disabling the warning all together. After a discussion with other
library authors I found it's bothering more people and decided to fix
it.

Removes this warning:

template<typename T, int N> struct StdArray {
    T contents[N];
  };

template<typename T, int N> struct AggregateAndEmpty : StdArray<T,N> { };

AggregateAndEmpty<int, 3> p = {1, 2, 3}; // <-- warning here about omitted braces




More information about the All-commits mailing list