Bug 65631 - seed_seq should not be copyable
Summary: seed_seq should not be copyable
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2015-03-30 16:18 UTC by TC
Modified: 2015-04-28 12:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-03-30 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description TC 2015-03-30 16:18:15 UTC
From http://stackoverflow.com/q/29350040/2756719, repro:

#include <random>

int main(int, char **)
{
  std::seed_seq seed1{1337, 42};
  std::seed_seq seed2(seed1);
  std::seed_seq seed3 = seed2;
  return 0;
}

Per the class synopsis in [rand.util.seedseq], the copy constructor and assignment operator of seed_seq are deleted:

// no copy functions
seed_seq(const seed_seq& ) = delete;
void operator=(const seed_seq& ) = delete;

But the above code, incorrectly, compiles using libstdc++.
Comment 1 Jonathan Wakely 2015-03-30 17:45:07 UTC
Confirmed, but we don't need to fix it for 5.1, it can wait.
Comment 2 Jonathan Wakely 2015-04-28 12:35:49 UTC
done
Comment 3 Jonathan Wakely 2015-04-28 12:36:02 UTC
Author: redi
Date: Tue Apr 28 12:35:30 2015
New Revision: 222524

URL: https://gcc.gnu.org/viewcvs?rev=222524&root=gcc&view=rev
Log:
	PR libstdc++/65631
	* include/bits/random.h (seed_seq) Define copy constructor and copy
	assignment as deleted.
	* testsuite/26_numerics/random/seed_seq/cons/65631.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/65631.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/random.h