https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66602

            Bug ID: 66602
           Summary: std::tuple bug when constructed with temporary empty
                    object
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: so61pi.re at gmail dot com
  Target Milestone: ---

-----
#include <iostream>
#include <tuple>

class empty_t {
};

int main() {
    // should print 1, but doesn't
    std::tuple<empty_t, int> a(empty_t{}, 1);
    std::cout << std::get<1>(a) << "\n";


    // works fine, prints 1
    std::tuple<int, empty_t> b(1, empty_t{});
    std::cout << std::get<0>(b) << "\n";


    // works fine, prints 1
    auto c = std::make_tuple(empty_t{}, 1);
    std::cout << std::get<1>(c) << "\n";
}
-----

This code works fine when compiled with MSVC or clang.

Reply via email to