FS#61873 - [gcc]internal compiler error: in cp_parser_lookup_name, at cp/parser.c:26145

Attached to Project: Arch Linux
Opened by Mohammad Nasirifar (farnasirim) - Wednesday, 27 February 2019, 03:16 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Monday, 11 May 2020, 07:11 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Bartłomiej Piotrowski (Barthalion)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

// Code:

#include <bits/stdc++.h>

using namespace std;

template<template<typename> typename Container, typename DataType>
concept bool Iterable = requires(Container<DataType> t) {
{ *t.begin() } -> DataType;
};

template<typename T>
ostream& operator<<(ostream& out, const Iterable<T>& t) {
for(auto it: t) {
out << it << " " ;
}
return out;
}

int main() {
return 0;
}

/* end code

gcc version: 8.2.1+20181127-1

Clearly this should not compile, but I still do not
expect an internal error.

*/
This task depends upon

Closed by  Bartłomiej Piotrowski (Barthalion)
Monday, 11 May 2020, 07:11 GMT
Reason for closing:  Fixed
Additional comments about closing:  10.1.0-1
Comment by Mohammad Nasirifar (farnasirim) - Wednesday, 27 February 2019, 03:17 GMT
Pre-processed source
Comment by Eli Schwartz (eschwartz) - Wednesday, 27 February 2019, 03:44 GMT
The code which you have specified correctly compiles to the extent necessary to throw fatal errors:

foo.cpp:8:1: error: ‘concept’ does not name a type
concept bool Iterable = requires(Container<DataType> t) {
^~~~~~~
foo.cpp:8:1: note: ‘concept’ only available with -fconcepts
foo.cpp:13:41: error: ‘Iterable’ does not name a type; did you mean ‘mutable’?
ostream& operator<<(ostream& out, const Iterable<T>& t) {
^~~~~~~~
mutable
foo.cpp:13:49: error: expected ‘,’ or ‘...’ before ‘<’ token
ostream& operator<<(ostream& out, const Iterable<T>& t) {
^
foo.cpp: In function ‘std::ostream& operator<<(std::ostream&, int)’:
foo.cpp:14:18: error: ‘t’ was not declared in this scope
for(auto it: t) {
^
foo.cpp:14:18: note: suggested alternative: ‘it’
for(auto it: t) {
^
it

No ICE in sight...
Comment by Mohammad Nasirifar (farnasirim) - Wednesday, 27 February 2019, 04:07 GMT
Sorry my bad. You have to compile with:

```
g++ nth-order-statistic.cpp -Wall -fconcepts
```
Comment by Allan McRae (Allan) - Friday, 13 December 2019, 13:09 GMT
Same error as this bug - probably fixed on gcc trunk.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85991

Loading...