public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore
@ 2010-03-31 20:18 sefi at s-e-f-i dot de
2010-04-01 10:49 ` [Bug c++/43608] " redi at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: sefi at s-e-f-i dot de @ 2010-03-31 20:18 UTC (permalink / raw)
To: gcc-bugs
The following code stopped working with gcc-4.5.
gcc-4.4.3 and clang both accept it.
On gcc-4.5, boost::mpl_::arg<2> is passed to metafunction instead of test1.
The strange thing is: If the specialization of metafunction<_2> is provided,
the code works again.
I'm sorry that this is not a minimal test case, because I don't know how to get
rid of the MPL parts.
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/vector/vector10.hpp>
struct test1
{
typedef int inner_type;
};
template<
typename Foo
>
struct metafunction
{
typedef typename Foo::inner_type type;
};
#if 0
template<>
struct metafunction<
boost::mpl::_2
>;
#endif
int main()
{
typedef boost::mpl::fold<
boost::mpl::vector1<
test1
>,
boost::mpl::vector0<>,
boost::mpl::push_back<
boost::mpl::_1,
metafunction<
boost::mpl::_2
>
>
>::type transformed;
boost::mpl::at_c<transformed, 0>::type i = 42;
}
--
Summary: Boost.MPL code doesn't get the placeholders substituted
anymore
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sefi at s-e-f-i dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/43608] Boost.MPL code doesn't get the placeholders substituted anymore
2010-03-31 20:18 [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore sefi at s-e-f-i dot de
@ 2010-04-01 10:49 ` redi at gcc dot gnu dot org
2010-04-01 10:53 ` redi at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-04-01 10:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from redi at gcc dot gnu dot org 2010-04-01 10:49 -------
Created an attachment (id=20271)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20271&action=view)
reduced testcase
reduced to just the instantiation that fails with 4.5
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/43608] Boost.MPL code doesn't get the placeholders substituted anymore
2010-03-31 20:18 [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore sefi at s-e-f-i dot de
2010-04-01 10:49 ` [Bug c++/43608] " redi at gcc dot gnu dot org
@ 2010-04-01 10:53 ` redi at gcc dot gnu dot org
2010-04-01 11:10 ` redi at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-04-01 10:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from redi at gcc dot gnu dot org 2010-04-01 10:53 -------
the subject line is misleading, I think the placeholders are still substituted
in exactly the same way, but as part of that an invalid instantiation is
generated while determining the template_arity of the metafunction.
The invalid instantiation occurs in a sizeof expression and was previously
ignored (presumably due to SFINAE) but now causes an error. I don't think
SFINAE applies in that context, which would make 4.5 correct
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/43608] Boost.MPL code doesn't get the placeholders substituted anymore
2010-03-31 20:18 [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore sefi at s-e-f-i dot de
2010-04-01 10:49 ` [Bug c++/43608] " redi at gcc dot gnu dot org
2010-04-01 10:53 ` redi at gcc dot gnu dot org
@ 2010-04-01 11:10 ` redi at gcc dot gnu dot org
2010-04-01 13:56 ` rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-04-01 11:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from redi at gcc dot gnu dot org 2010-04-01 11:10 -------
Created an attachment (id=20272)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20272&action=view)
reduced testcase with fix added but commented out
Comeau's online compiler agrees with GCC 4.5
As the reporter says, the testcase can be fixed by adding an explicit
specialisation of metafunction< arg<2> > ... I don't know why this works.
The second attachment has the specialisation, commented out.
--
redi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #20271|0 |1
is obsolete| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/43608] Boost.MPL code doesn't get the placeholders substituted anymore
2010-03-31 20:18 [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore sefi at s-e-f-i dot de
` (2 preceding siblings ...)
2010-04-01 11:10 ` redi at gcc dot gnu dot org
@ 2010-04-01 13:56 ` rguenth at gcc dot gnu dot org
2010-04-01 14:47 ` jason at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-01 13:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2010-04-01 13:56 -------
EDG accepts the reduced testcase in strict mode.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/43608] Boost.MPL code doesn't get the placeholders substituted anymore
2010-03-31 20:18 [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore sefi at s-e-f-i dot de
` (3 preceding siblings ...)
2010-04-01 13:56 ` rguenth at gcc dot gnu dot org
@ 2010-04-01 14:47 ` jason at gcc dot gnu dot org
2010-04-01 15:00 ` jason at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-04-01 14:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jason at gcc dot gnu dot org 2010-04-01 14:47 -------
My copy of EDG 4.1 does not accept the reduced testcase; it gives the same
error as GCC 4.5.
"red.cc", line 111: error: class "arg<2>" has no member "inner_type"
typedef typename Foo::inner_type type;
^
detected during:
instantiation of class "metafunction<Foo> [with Foo=arg<2>]" at
line 83
instantiation of class "template_arity_impl<F, N> [with
F=metafunction<arg<2>>, N=1]" at line 91
instantiation of class
"template_arity<F> [with F=metafunction<arg<2>>]" at
line 116
We instantiate metafunction<arg<2>> for argument-dependent lookup of the call
to arity_helper(type_wrapper<F>). 3.4.2 says that if an argument type is a
class template specialization, we consider the associated classes and
namespaces of the template arguments, which in this case means F, or
metafunction<arg<2>>. And in order to perform that lookup, we instantiate
metafunction<arg<2>>.
Providing the explicit specialization prevents the implicit instantiation, so
argument-dependent lookup just doesn't consider that scope. This is also fully
conformant.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/43608] Boost.MPL code doesn't get the placeholders substituted anymore
2010-03-31 20:18 [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore sefi at s-e-f-i dot de
` (4 preceding siblings ...)
2010-04-01 14:47 ` jason at gcc dot gnu dot org
@ 2010-04-01 15:00 ` jason at gcc dot gnu dot org
2010-04-01 15:22 ` sefi at s-e-f-i dot de
2010-04-18 15:04 ` jason at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-04-01 15:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jason at gcc dot gnu dot org 2010-04-01 14:59 -------
Another way to fix the testcase would be to give an explicit scope for
arity_helper, so argument-dependent lookup isn't needed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/43608] Boost.MPL code doesn't get the placeholders substituted anymore
2010-03-31 20:18 [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore sefi at s-e-f-i dot de
` (5 preceding siblings ...)
2010-04-01 15:00 ` jason at gcc dot gnu dot org
@ 2010-04-01 15:22 ` sefi at s-e-f-i dot de
2010-04-18 15:04 ` jason at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: sefi at s-e-f-i dot de @ 2010-04-01 15:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from sefi at s-e-f-i dot de 2010-04-01 15:21 -------
Thank you all very much. Explicitly scoping arity_helper indeed fixes the
issue.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/43608] Boost.MPL code doesn't get the placeholders substituted anymore
2010-03-31 20:18 [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore sefi at s-e-f-i dot de
` (6 preceding siblings ...)
2010-04-01 15:22 ` sefi at s-e-f-i dot de
@ 2010-04-18 15:04 ` jason at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-04-18 15:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jason at gcc dot gnu dot org 2010-04-18 15:04 -------
*** Bug 43775 has been marked as a duplicate of this bug. ***
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pluto at agmk dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-04-18 15:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-31 20:18 [Bug c++/43608] New: Boost.MPL code doesn't get the placeholders substituted anymore sefi at s-e-f-i dot de
2010-04-01 10:49 ` [Bug c++/43608] " redi at gcc dot gnu dot org
2010-04-01 10:53 ` redi at gcc dot gnu dot org
2010-04-01 11:10 ` redi at gcc dot gnu dot org
2010-04-01 13:56 ` rguenth at gcc dot gnu dot org
2010-04-01 14:47 ` jason at gcc dot gnu dot org
2010-04-01 15:00 ` jason at gcc dot gnu dot org
2010-04-01 15:22 ` sefi at s-e-f-i dot de
2010-04-18 15:04 ` jason at gcc dot gnu dot 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).