TGStat
TGStat
Type to search
Advanced channel search
  • flag English
    Site language
    flag Russian flag English flag Uzbek
  • Sign In
  • Catalog
    Channels and groups catalog Regional compilations Thematic compilations Платные каналы Search for channels
    Add a channel/group
  • Ratings
    Rating of channels Rating of groups Posts rating
    Ratings of brands and people
  • Analytics
  • Search by posts
  • Telegram monitoring
  • Promotion
    Advertising through Yandex Business Advertising in channels through TGStat Agency Advertising on TGStat.ru website
C++ and other lectures

31 Jul, 18:37

Open in Telegram Share Report

И снова пятничный зачилл.

Подумайте вот о таком коде. Сначала не открывая годболт. Что скажете?

struct T { const int &p; };

void foo() { T t{0}; } // ???

void bar() { T t(0); } // ???

Теперь откройте ссылку и сверьте ощущения.

https://godbolt.org/z/6rfGzx991

Кто прав — gcc или clang? Или... оба? ))) Ссылки на стандарт обязательны. За нейронку — штрафные баллы ))

Пример восхитителен не глубокими причинами в стандарте, а тем насколько всё тупо. В общем смешной кейс на пятничный вечер.

#questions
Compiler Explorer - C++
struct T { const int &p; }; void foo() { T t{0}; } // both ok void bar() { T t(0); } // gcc ok, clang fail void buz() { int x = 0; T t{x}; } // both ok void baz() { int x = 0; T t(x); } // gcc ok, clang fail

8.8k 0 32 20 45
Catalog
Channels and groups catalog Channels compilations Search for channels Add a channel/group
Ratings
Rating of Telegram channels Rating of Telegram groups Posts rating Ratings of brands and people
API
API statistics Search API of posts API Callback
Our channels
@TGStat @TGStat_Chat @telepulse @TGStatAPI
Read
Академия TGStat Telegram Research 2019 Telegram Research 2021 Telegram Research 2023
Contacts
Справочный центр Support Email Jobs
Miscellaneous
Terms and conditions Privacy policy Public offer
Our bots
@TGStat_Bot @SearcheeBot @TGAlertsBot @tg_analytics_bot @TGStatChatBot