This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66602] New: std::tuple bug when constructed with temporary empty object
- From: "so61pi.re at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 19 Jun 2015 17:09:41 +0000
- Subject: [Bug c++/66602] New: std::tuple bug when constructed with temporary empty object
- Auto-submitted: auto-generated
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.