Bug 29186 - fill_n, generate_n assume Size is modifiable
Summary: fill_n, generate_n assume Size is modifiable
Status: CLOSED FIXED
Alias: None
Product: Branch p6
Classification: Distributions
Component: libstdc++4.5-devel (show other bugs)
Version: не указана
Hardware: all Linux
: P3 normal
Assignee: Andrey Cherepanov
QA Contact: QA p6
URL: http://gcc.gnu.org/bugzilla/show_bug....
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-15 15:17 MSK by Anton Farygin
Modified: 2013-07-19 05:21 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Farygin 2013-07-15 15:17:27 MSK
Нарвался на эту ошибку в gcc.

Просьба приложить патч:
http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=159677

testcase:

#include <algorithm>

struct Size {
    operator int() { return 0; }
private:
    void operator=(Size&);
};

template int* std::fill_n (int*, Size, const int&);
template int* std::generate_n (int*, Size, int (*)());

int main () { }
Comment 1 Dmitry V. Levin 2013-07-18 17:42:07 MSK
Патч выглядит безобидным, можно было бы и приложить.

В апстримной ветке gcc-4_5-branch после выпуска 4.5.4 коммитов не было, очевидно, эта ветка закрыта год назад.
Зато в gcc-4_6-branch, в которой находится обсуждаемый фикс на bits/stl_algobase.h и bits/stl_algo.h, есть еще много разных полезных фиксов, возможно, с побочными эффектами.

Лучше, конечно, пользоваться более свежими компиляторами.
Comment 2 Repository Robot 2013-07-19 05:21:23 MSK
gcc4.5-4.5.4-alt2 -> sisyphus:

* Thu Jul 18 2013 Dmitry V. Levin <ldv@altlinux> 4.5.4-alt2
- libstdc++4.5-devel: backported upstream fix for gcc#25306
  (closes: #29186).