Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is auto as a parameter in a regular function a GCC 4.9 extension?

Tags:

gcc 4.9 allows the following code, but gcc 4.8 and clang 3.5.0 reject it.

void foo(auto c) {     std::cout << c.c_str(); } 

I get warning: ISO C++ forbids use of 'auto' in parameter declaration [-Wpedantic] in 4.9 but in 4.8 and clang I get error: parameter declared 'auto'.

like image 818
user4048234 Avatar asked Sep 16 '14 23:09

user4048234


1 Answers

Yes, this is an extension. It's likely to be added to C++17 as part of the 'concepts' proposal, I believe.

like image 51
bames53 Avatar answered Sep 23 '22 02:09

bames53