public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61806] New: [C++11] Expression sfinae w/o access gives hard error in partial template specializations
@ 2014-07-15 9:10 daniel.kruegler at googlemail dot com
2014-12-14 0:49 ` [Bug c++/61806] " ville.voutilainen at gmail dot com
2021-04-28 21:08 ` ppalka at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-07-15 9:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61806
Bug ID: 61806
Summary: [C++11] Expression sfinae w/o access gives hard error
in partial template specializations
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: daniel.kruegler at googlemail dot com
The following code, compiled with gcc 4.10.0 20140714 (experimental) using the
flags
-Wall -Wextra -std=c++11 -pedantic
or - alternatively -
-Wall -Wextra -std=c++1y -pedantic
//-----------------------
struct true_type
{
static const bool value = true;
};
struct false_type
{
static const bool value = false;
};
template<class T>
T&& declval();
template<typename> struct check { typedef void type; };
template<typename T, typename Enable = void>
struct has_public_f : false_type {};
template<typename T>
struct has_public_f<
T,
typename check<
decltype(
declval<T&>().f()
)
>::type
> : true_type {};
struct Spub { public: void f(); };
struct Spriv { private: void f(); };
static_assert( has_public_f<Spub>::value, "Ouch");
static_assert(!has_public_f<Spriv>::value, "Ouch");
int main() {}
//-----------------------
is rejected with the following diagnostics:
<quote>
prog.cc: In instantiation of 'struct has_public_f<Spriv>':
prog.cc:33:35: required from here
prog.cc:30:30: error: 'void Spriv::f()' is private
struct Spriv { private: void f(); };
^
prog.cc:27:15: error: within this context
> : true_type {};
^
prog.cc:30:30: error: 'void Spriv::f()' is private
struct Spriv { private: void f(); };
^
prog.cc:27:15: error: within this context
> : true_type {};
^
prog.cc:30:30: error: 'void Spriv::f()' is private
struct Spriv { private: void f(); };
^
prog.cc:33:16: error: within this context
static_assert(!has_public_f<Spriv>::value, "Ouch");
^
prog.cc:33:1: error: static assertion failed: Ouch
static_assert(!has_public_f<Spriv>::value, "Ouch");
^
</quote>
It seems that in this context there is no silent rejection of the partial
specialization, albeit it should.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/61806] [C++11] Expression sfinae w/o access gives hard error in partial template specializations
2014-07-15 9:10 [Bug c++/61806] New: [C++11] Expression sfinae w/o access gives hard error in partial template specializations daniel.kruegler at googlemail dot com
@ 2014-12-14 0:49 ` ville.voutilainen at gmail dot com
2021-04-28 21:08 ` ppalka at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 0:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61806
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-14
CC| |ville.voutilainen at gmail dot com
Ever confirmed|0 |1
Known to fail|4.10.0 |5.0
--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Clang accepts the code.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/61806] [C++11] Expression sfinae w/o access gives hard error in partial template specializations
2014-07-15 9:10 [Bug c++/61806] New: [C++11] Expression sfinae w/o access gives hard error in partial template specializations daniel.kruegler at googlemail dot com
2014-12-14 0:49 ` [Bug c++/61806] " ville.voutilainen at gmail dot com
@ 2021-04-28 21:08 ` ppalka at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-28 21:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61806
--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 80475 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-28 21:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-15 9:10 [Bug c++/61806] New: [C++11] Expression sfinae w/o access gives hard error in partial template specializations daniel.kruegler at googlemail dot com
2014-12-14 0:49 ` [Bug c++/61806] " ville.voutilainen at gmail dot com
2021-04-28 21:08 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).