This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Movable initializer lists (C++ N4166)


Hi all,

A couple months ago I created a patch for movable initializer lists, as proposed in N4166. (A few additional details appeared during implementation, which I can document if anyone asks.) Reference: http://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n4166.pdf

As I was in the final stages of debugging and running the full testsuite, my motherboard burned out. Now Iâm trying to get back into it, but the "make check" targets wonât do anything at all. This problem has happened before, and sometimes resolves itself mysteriously. I canât do a proper clean reinstall now because Clang (Iâm on OS X) wonât build GCC; it seems to be confused by C++ source files named with .c. So, everything is getting bootstrapped from a trunk version of GCC that I had sitting around. Thatâs probably not the problem, though; something must be wrong with DejaGnu or the makefiles.

Iâm sure Iâm close to the finish line, but constantly reinstalling, clean-rebuilding, and trying to diagnose tool failures seems like a waste of time and an undue strain on my laptop. I would greatly appreciate help from a more experienced contributor, or even just access to a proper build process on a fast CPU. Or even just any kind of support or compensation for my GCC efforts in general. There are several more proposals I should prototype, and Iâll be getting either a lot more involved in GCC or a lot less.

(Yes, I know that a âcompile farmâ exists. It appears to be obsolete; perhaps someone could vouch for it?)

The patch is missing testcases. Any contributions, review, or feedback would be appreciated. To summarize its contents:

- gcc/cp/call.c:
    build_list_conv: Allow rvalue reference tag in std::initializer_list.
    convert_like_real: Support sequence-owning std::initializer_list:
        Detect rvalue reference tag indicating ownership.
        Initialize by constructor instead of as aggregate.
        Disable static storage optimization for an owning list.
        Disable the cleanup of the array of an owning list.
        Disable the destructor of an owning list of trivial sequence.
    compare_ics: Conversion of a list to owning/non-owning std::initializer_list is preferred for nontrivial/trivial move constructor, respectively.
    set_up_extended_ref_temp: Do not build a destructor for a TARGET_EXPR with no cleanup.
    extend_ref_init_temps: Process a constructor call for std::initializer_list, not aggregate initialization.
- gcc/cp/init.c:
    perform_member_init: Process a constructor call for std::initializer_list, not aggregate initialization.
- gcc/cp/class.c:
    finish_struct: Accept new format of std::initializer_list<T&&>.
- gcc/cp/decl.c:
    cp_finish_decl: Reject owning initializer lists as nonstatic members.
- gcc/cp/typeck.c:
    check_return_expr: Reject owning initializer lists as return values.
- gcc/cp/pt.c:
    unify: Deduction of T in std::initializer_list<T&&> ignores the rvalue reference specifier.
- gcc/cp/search.c:
    accessible_p: std::initializer_list is exempt from access checking.
- gcc/cp/semantics.c:
    trait_expr_value: Owning initializer list is trivially destructible if its sequence is.
- libstdc++-v3/libsupc++/initializer_list
    class initializer_list<T>:
        Preserve internal modifiable access to sequence.
        Disable move assignment operator. (CWG DR 2432)
    class initializer_list<T&&>: New.
- gcc/testsuite/g++.dg/cpp0x/pr57101.C: Emulate new <initializer_list>.
- gcc/testsuite/g++.dg/cpp1z/initlist-owned.C: Check order of destruction functionality.
    Incomplete.
- libstdc++-v3/testsuite/20_util/is_assignable/value.cc
    Reverse availability checks on std::initializer_list value assignability.
    Add checks for owning initializer lists.
- libstdc++-v3/testsuite/util/testsuite_random.h
    Remove std::initializer_list assignment operation, and UB due to reliance on unspecified storage of temporary values.

	- Thanks,
	David


Attachment: movil.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]