Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Daniel Krügler <daniel.kruegler@googlemail.com> |
|---|---|
| Newsgroups | comp.std.c++ |
| Subject | Re: Private access in partial specialization definitions |
| Date | 2012-12-15 10:53 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <kafqa8$fg3$1@dont-email.me> (permalink) |
| References | <2a114d05-b6ad-4e19-9e0b-050a795f3a63@googlegroups.com> |
Am 14.12.2012 18:20, schrieb maowfijwef@amfoijefa.ca:
> GCC's behavior differs from Clang and Visual C++ in the following examples:
>
> #include<type_traits>
>
> template<typename T, typename Enabler = void>
> struct test1 : std::false_type {};
>
> template<typename T>
> struct test1<T, typename T::typedef_test> : std::true_type {};
>
> template<typename T, typename Enabler = void>
> struct test2 : std::false_type {};
>
> template<typename T>
> struct test2<T,
> typename std::enable_if<
> T::enum_test,
> void
> >::type> : std::true_type {};
>
> struct object
> {
> template<typename T, typename Enabler>
> friend struct test1;
>
> template<typename T, typename Enabler>
> friend struct test2;
>
> private:
> enum { enum_test = true };
> typedef void typedef_test;
> };
>
> // test1
> static_assert(test1<object>::value, "failed");
>
> // test2
> static_assert(test2<object>::value, "failed");
>
> Results (compiler, test1, test2):
> g++ (4.7.2), pass, fail
> g++ (4.8.0), fail, fail
> clang++ (3.3), pass, pass
> Visual C++ 2012, pass, pass
>
> Which is correct? I'd appreciate direction to the relevant sections of
> the standard if at all possible.
With the resolution of the issue
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#580
the code should be well-formed. It looks to me as if gcc hasn't yet
applied the resolution. I suggest to open a compiler bug for this.
HTH & Greetings from Bremen,
Daniel Krügler
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to comp.std.c++ | Previous | Next — Previous in thread | Find similar
Private access in partial specialization definitions maowfijwef@amfoijefa.ca - 2012-12-14 09:20 -0800 Re: Private access in partial specialization definitions Daniel Krügler <daniel.kruegler@googlemail.com> - 2012-12-15 10:53 -0800
csiph-web