[Bug c++/21802] Two-stage name lookup fails for operators

2016-04-09 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21802

Patrick Palka  changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org

--- Comment #10 from Patrick Palka  ---
Yes, it looks like a bug.  Could you please file a separate bug report?  You
can use this as the minimal reproducer:

struct A { };

A operator+ (A &) { return A (); }
A operator+ (const A &) { return A (); }


template 
void
foo ()
{
  +A ();
}

void
bar ()
{
  foo ();
}

[Bug c++/21802] Two-stage name lookup fails for operators

2016-04-09 Thread david.abdurachmanov at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21802

--- Comment #9 from David Abdurachmanov  
---
Created attachment 38230
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38230=edit
Failing file (pre-processed)

[Bug c++/21802] Two-stage name lookup fails for operators

2016-04-09 Thread david.abdurachmanov at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21802

David Abdurachmanov  changed:

   What|Removed |Added

 CC||david.abdurachmanov at gmail 
dot c
   ||om

--- Comment #8 from David Abdurachmanov  
---
While looking at the last compilation issues while reg testing GCC 6.0.0, I
bumped into this one. The code compiles file with GCC 5.3.0. The code compiles
fine with Clang 3.7.0 (have not checked 3.8.0 or ICC yet, but can be done on
request).

git bisect pointed me to this fix (full bisect log is below).

d175f0193ed47b61eafd213ca2d3dde73f8f5996 is the first bad commit
commit d175f0193ed47b61eafd213ca2d3dde73f8f5996
Author: ppalka 
Date:   Tue Dec 15 03:33:53 2015 +

Fix PR c++/21802 (two-stage name lookup fails for operators)

Failing file (pre-processed) is attached and I am running C-Reduce to get
something more minimal. I am currently not sure if this a compiler issue or not
thus not creating a separate BZ item.

### COMPILE LINE ###

c++ -c -ansi -fPIC -O2  Algorithm.ii

Removing -ansi seems to solve compilation issue.

### ERROR ### 

Algorithm.cc: In instantiation of 'Algorithm::grammar::grammar()
[with Iterator = __gnu_cxx::__normal_iterator >]':
Algorithm.cc:119:11:   required from here
Algorithm.cc:76:16: error: invalid initialization of non-const reference of
type 'boost::proto::exprns_::expr, boost::fusion::vector1 > >, 0l>&' from an rvalue of type
'boost::spirit::terminal >::result::type {aka
boost::proto::exprns_::expr, boost::fusion::vector1 > >, 0l>}'
   = lexeme[+char_("a-zA-Z0-9{}[],_.+-")]
^~~~
In file included from
/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/proto/core.hpp:26:0,
 from
/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/proto/proto.hpp:12,
 from
/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/spirit/home/support/meta_compiler.hpp:19,
 from
/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/spirit/home/qi/meta_compiler.hpp:14,
 from
/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/spirit/home/qi/action/action.hpp:14,
 from
/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/spirit/home/qi/action.hpp:14,
 from
/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/spirit/home/qi.hpp:14,
 from
/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/spirit/include/qi.hpp:16,
 from Algorithm.cc:7:

/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/proto/operators.hpp:116:5:
note:   initializing argument 1 of 'const typename
boost::proto::detail::enable_unary::type
boost::proto::exprns_::operator+(Arg&) [with Arg =
boost::proto::exprns_::expr, boost::fusion::vector1 > >, 0l>; typename
boost::proto::detail::enable_unary::type =
boost::proto::exprns_::expr, boost::fusion::vector1 > >, 0l>&>, 1l>]'
 operator OP(Arg  BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST)
 \
 ^
/home/david.abdurachmanov/gcc600/test/fc22_ppc64le_gcc600/external/boost/1.57.0/include/boost/proto/operators.hpp:236:5:
note: in expansion of macro 

[Bug c++/21802] Two-stage name lookup fails for operators

2015-12-15 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21802

Paolo Carlini  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |6.0

--- Comment #7 from Paolo Carlini  ---
Fixed then.

[Bug c++/21802] Two-stage name lookup fails for operators

2015-12-14 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21802

--- Comment #6 from Patrick Palka  ---
Author: ppalka
Date: Tue Dec 15 03:33:53 2015
New Revision: 231640

URL: https://gcc.gnu.org/viewcvs?rev=231640=gcc=rev
Log:
Fix PR c++/21802 (two-stage name lookup fails for operators)

gcc/cp/ChangeLog:

PR c++/21802
PR c++/53223
* cp-tree.h (cp_tree_code_length): Declare.
(build_min_non_dep_op_overload): Declare.
* tree.c (cp_tree_code_length): Define.
(build_min_non_dep_op_overload): Define.
(build_win_non_dep_call_vec): Copy the KOENIG_LOOKUP_P flag.
* typeck.c (build_x_indirect_ref): Use
build_min_non_dep_op_overload when the given expression
has been resolved to an operator overload.
(build_x_binary_op): Likewise.
(build_x_array_ref): Likewise.
(build_x_unary_op): Likewise.
(build_x_compound_expr): Likewise.
(build_x_modify_expr): Likewise.
* decl2.c (grok_array_decl): Likewise.
* call.c (build_new_op_1): If during template processing we
chose an operator overload that is a hidden friend function, set
the call's KOENIG_LOOKUP_P flag to 1.

gcc/testsuite/ChangeLog:

PR c++/21802
PR c++/53223
* g++.dg/cpp0x/pr53223.C: New test.
* g++.dg/lookup/pr21802.C: New test.
* g++.dg/lookup/two-stage4.C: Remove XFAIL.


Added:
trunk/gcc/testsuite/g++.dg/cpp0x/pr53223.C
trunk/gcc/testsuite/g++.dg/lookup/pr21802.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/decl2.c
trunk/gcc/cp/tree.c
trunk/gcc/cp/typeck.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/lookup/two-stage4.C

[Bug c++/21802] Two-stage name lookup fails for operators

2014-05-18 Thread richard-gccbugzilla at metafoo dot co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21802

--- Comment #4 from Richard Smith richard-gccbugzilla at metafoo dot co.uk ---
EDG accepts this (which I believe is the correct answer). Clang and GCC reject
(in Clang's case, the callee is resolved in the template definition, but then
ADL is accidentally performed during template instantiation; I've not looked
into where this goes wrong for GCC). The bug seems valid to me.


[Bug c++/21802] Two-stage name lookup fails for operators

2014-05-18 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21802

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

 CC|paolo.carlini at oracle dot com|

--- Comment #5 from Paolo Carlini paolo.carlini at oracle dot com ---
Ah, Ok thanks. The EDG I was using as part of ICC also rejected it.


[Bug c++/21802] Two-stage name lookup fails for operators

2014-05-17 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21802

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

 CC||paolo.carlini at oracle dot 
com,
   ||richard-gccbugzilla@metafoo
   ||.co.uk

--- Comment #3 from Paolo Carlini paolo.carlini at oracle dot com ---
Let's double check with Richard that this specific issue can be closed.


[Bug c++/21802] Two-stage name lookup fails for operators

2013-10-09 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21802

--- Comment #2 from Paolo Carlini paolo.carlini at oracle dot com ---
This bug likely needs an update: the testcase is still rejected, but likewise
happens with ICC and clang.