[Bug c++/85806] New: [concepts] Hard error for "invalid use of non-static data member" in a requires expression
Casey at Carter dot net
gcc-bugzilla@gcc.gnu.org
Wed May 16 13:39:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85806
Bug ID: 85806
Summary: [concepts] Hard error for "invalid use of non-static
data member" in a requires expression
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Casey at Carter dot net
Target Milestone: ---
Compiling this program fragment with g++ -std=c++17 -fconcepts
(https://godbolt.org/g/L1b6TS):
template<int> using helper = void;
template<typename T>
concept bool HasCount = requires {
typename ::helper<T::count>;
};
struct S {
int count = 42;
};
static_assert(!HasCount<S>);
produces a diagnostic:
<source>:11:18: error: invalid use of non-static data member 'S::count'
static_assert(!HasCount<S>);
^~~~~~~~~~~
<source>:9:19: note: declared here
int count = 42;
^~
rather than the expected successful and silent compile.
More information about the Gcc-bugs
mailing list