dememax: (Hacker Emblem)
dememax ([personal profile] dememax) wrote2016-09-19 07:04 pm
Entry tags:

cppreference.com - Си++ Вики / "Most Surprising" from "The Grand C++ Error Explosion Competition"

Что-то я пропустил "новость": у Си++ есть теперь свой Вики - http://cppreference.com/
Ну, не сразу, ну, уже давно, ну, ...
Короче, если интересна история сайта:
CppCon 2014: Nate Kohl "cppreference.com: documenting C++ one edit at a time"

В видео есть слайд с одним из победителей "The Grand C++ Error Explosion Competition", категория "Most surprising":
template<class T>class L{L<T*>operator->()};L<int>i=i->
Запустил у себя с gcc 6.2, действительно, поразительный эффект: я устал ждать, очень долго работал компилятор и генерил без остановки вывод:
a.cpp:1:42: error: expected ‘;’ at end of member declaration
template<class T>class L{L<T*>operator->()};L<int>i=i->
^
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp: In instantiation of ‘L<T*> L<T>::operator->() [with T = int]’:
a.cpp:1:54: required from here
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int*]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int**]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int***]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int****]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int*****]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int******]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~
a.cpp:1:31: note: declared private here
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~~~~~~~
a.cpp:1:54: error: ‘L<T*> L<T>::operator->() [with T = int*******]’ is private within this context
template<class T>class L{L<T*>operator->()};L<int>i=i->
^~

[identity profile] itman.livejournal.com 2016-09-19 06:00 pm (UTC)(link)
Давно пользуюсь этим сайтом, не знал, что это вики.