[Bug c++/86717] New: Unexpected error in dynamic allocation of an array of function pointers
v.reshetnikov at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 29 02:04:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86717
Bug ID: 86717
Summary: Unexpected error in dynamic allocation of an array of
function pointers
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: v.reshetnikov at gmail dot com
Target Milestone: ---
/****************** BEGIN SOURCE ******************/
template<typename T>
void f() {
typedef void(*arr[T::value])();
new arr; // OK
new (void(*[(T::value)])()); // OK
new (void(*[T::value])()); // error: capture of non-variable 'T'
}
struct S {
static constexpr int value = 5;
};
int main() {
f<S>();
}
/******************* END SOURCE *******************/
The last new-expression is rejected (as I believe, incorrectly). For
comparison, clang and MSVC compile this code successfully.
Tested with build 9.0.0 20180726 (experimental).
More information about the Gcc-bugs
mailing list