https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53972
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-08-20
CC| |egallager at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
Huh, there's an extra error message in c++11 compared to c++14:
$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -std=gnu++11 53972.cc
53972.cc: In function ‘int main()’:
53972.cc:27:24: warning: statement has no effect [-Wunused-value]
Constify<value>::value;
^
53972.cc: In instantiation of ‘constexpr char sub1(const char (&)[N], unsigned
int) [with unsigned int N = 4]’:
53972.cc:23:15: required from here
53972.cc:10:29: error: ‘array’ is not a constant expression
return Constify<array[I]>::value;
^~~~~
53972.cc:10:23: note: in template argument for type ‘unsigned int’
return Constify<array[I]>::value;
~~~~~^
53972.cc:11:1: error: body of constexpr function ‘constexpr char sub1(const
char (&)[N], unsigned int) [with unsigned int N = 4]’ not a return-statement
}
^
$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -std=gnu++14 53972.cc
53972.cc: In function ‘int main()’:
53972.cc:27:24: warning: statement has no effect [-Wunused-value]
Constify<value>::value;
^
53972.cc: In instantiation of ‘constexpr char sub1(const char (&)[N], unsigned
int) [with unsigned int N = 4]’:
53972.cc:23:15: required from here
53972.cc:10:29: error: ‘array’ is not a constant expression
return Constify<array[I]>::value;
^~~~~
53972.cc:10:23: note: in template argument for type ‘unsigned int’
return Constify<array[I]>::value;
~~~~~^
$
Confirmed.