public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29131]  New: Bad name lookup for templates
@ 2006-09-18 16:39 andrew dot stubbs at st dot com
  2006-09-18 17:28 ` [Bug c++/29131] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 27+ messages in thread
From: andrew dot stubbs at st dot com @ 2006-09-18 16:39 UTC (permalink / raw)
  To: gcc-bugs

The following C++ code should not compile:

template<class T>
int t(T i)
{
  return f (i);  // error: f not visible here
}

int
f (int i)
{
  return i;
}

int
main()
{
  return t(1);
}

The C++ standard clause 14.6.3 states that names should be looked up from the
point they are used. I.e. functions defined after that point are not visible.
This is true for regular functions, but GCC does not get this right for
template functions.


-- 
           Summary: Bad name lookup for templates
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andrew dot stubbs at st dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] Bad name lookup for templates
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
@ 2006-09-18 17:28 ` pinskia at gcc dot gnu dot org
  2006-09-19  3:47 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-18 17:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-09-18 17:28 -------
(In reply to comment #0)
> The C++ standard clause 14.6.3 states that names should be looked up from the
> point they are used. I.e. functions defined after that point are not visible.
> This is true for regular functions, but GCC does not get this right for
> template functions.

No you missed something but I don't have the standard in front of me.
14.6.3 is talking about something different.  Anyways this is unqualified
function call that is dependent on a template arguments.

I think 14.6.3 is really talking about what PR 2922 is about and not this one.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] Bad name lookup for templates
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
  2006-09-18 17:28 ` [Bug c++/29131] " pinskia at gcc dot gnu dot org
@ 2006-09-19  3:47 ` pinskia at gcc dot gnu dot org
  2006-09-19  3:49 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19  3:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-09-19 03:47 -------
Actually wait, what is happening here is ADL is happening for fundemantal types
which is a question of a Defect report, I forgot which one now.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] Bad name lookup for templates
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
  2006-09-18 17:28 ` [Bug c++/29131] " pinskia at gcc dot gnu dot org
  2006-09-19  3:47 ` pinskia at gcc dot gnu dot org
@ 2006-09-19  3:49 ` pinskia at gcc dot gnu dot org
  2006-09-19  3:51 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19  3:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-09-19 03:49 -------
Actually you missed 14.6.4.2.  This really has nothing to do with 14.6.3.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] Bad name lookup for templates
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (2 preceding siblings ...)
  2006-09-19  3:49 ` pinskia at gcc dot gnu dot org
@ 2006-09-19  3:51 ` pinskia at gcc dot gnu dot org
  2006-09-19  4:06 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19  3:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-09-19 03:51 -------
Also "f (i)" is a dependent expression because of 14.6.2/1 as i is (obviously)
dependent so 14.6.3 does not apply.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] Bad name lookup for templates
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (3 preceding siblings ...)
  2006-09-19  3:51 ` pinskia at gcc dot gnu dot org
@ 2006-09-19  4:06 ` pinskia at gcc dot gnu dot org
  2006-09-19  4:30 ` [Bug c++/29131] [DR 225] " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19  4:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-09-19 04:06 -------
So GCC does not implement 14.6.4.2/1, part 1:
- For the part of look using unqualified name lookup (3.4.1), only function
declareations with external linkage from the template context are found.

And since ADL on fundalment types not exist, that is the only part that happens
so this is invalid code based on that and nothing else.

Next time becareful when trying to figuring out why something is invalid code
because it is easy to get it wrong and then have a someone else having to look
at the standard to prove you wrong.  In fact the following is valid code
because of ADL (since template instantiation conext is also included for ADL):
template<class T>
int t(T i)
{
  return f (i);  // error: f not visible here
}

struct a{};

int
f (a i)
{
  return 0;
}

int
main()
{
  a b;
  return t(b);
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-19 04:06:38
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (4 preceding siblings ...)
  2006-09-19  4:06 ` pinskia at gcc dot gnu dot org
@ 2006-09-19  4:30 ` pinskia at gcc dot gnu dot org
  2009-12-05  0:13 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-19  4:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-09-19 04:30 -------
This is DR 225 really.
http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_active.html#225
Which means there is a question if this is really invalid code after all.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |SUSPENDED
            Summary|Bad name lookup for         |[DR 225] Bad name lookup for
                   |templates                   |templates


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (5 preceding siblings ...)
  2006-09-19  4:30 ` [Bug c++/29131] [DR 225] " pinskia at gcc dot gnu dot org
@ 2009-12-05  0:13 ` pinskia at gcc dot gnu dot org
  2009-12-08 22:03 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-05  0:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2009-12-05 00:13 -------
*** Bug 42281 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jezz at hkfree dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (6 preceding siblings ...)
  2009-12-05  0:13 ` pinskia at gcc dot gnu dot org
@ 2009-12-08 22:03 ` pinskia at gcc dot gnu dot org
  2010-02-05 12:52 ` [Bug c++/29131] [DR 225] Bad name lookup for templates due to foundemtal types namespace for ADL paolo dot carlini at oracle dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-08 22:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2009-12-08 22:02 -------
*** Bug 34886 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rvovsd at mail dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to foundemtal types namespace for ADL.
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (7 preceding siblings ...)
  2009-12-08 22:03 ` pinskia at gcc dot gnu dot org
@ 2010-02-05 12:52 ` paolo dot carlini at oracle dot com
  2010-03-04 20:28 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-02-05 12:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from paolo dot carlini at oracle dot com  2010-02-05 12:52 -------
*** Bug 31816 has been marked as a duplicate of this bug. ***


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nicolas dot burrus at ensta
                   |                            |dot fr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to foundemtal types namespace for ADL.
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (8 preceding siblings ...)
  2010-02-05 12:52 ` [Bug c++/29131] [DR 225] Bad name lookup for templates due to foundemtal types namespace for ADL paolo dot carlini at oracle dot com
@ 2010-03-04 20:28 ` pinskia at gcc dot gnu dot org
  2010-03-24 16:45 ` [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-04 20:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2010-03-04 20:28 -------
*** Bug 43261 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boostcpp at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (9 preceding siblings ...)
  2010-03-04 20:28 ` pinskia at gcc dot gnu dot org
@ 2010-03-24 16:45 ` pinskia at gcc dot gnu dot org
  2010-03-29 20:53 ` pinskia at gcc dot gnu dot org
  2010-07-29 15:20 ` pinskia at gcc dot gnu dot org
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-24 16:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2010-03-24 16:45 -------
*** Bug 43506 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yao_yin at 163 dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (10 preceding siblings ...)
  2010-03-24 16:45 ` [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental " pinskia at gcc dot gnu dot org
@ 2010-03-29 20:53 ` pinskia at gcc dot gnu dot org
  2010-07-29 15:20 ` pinskia at gcc dot gnu dot org
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-29 20:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pinskia at gcc dot gnu dot org  2010-03-29 20:53 -------
*** Bug 43506 has been marked as a duplicate of this bug. ***


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
  2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
                   ` (11 preceding siblings ...)
  2010-03-29 20:53 ` pinskia at gcc dot gnu dot org
@ 2010-07-29 15:20 ` pinskia at gcc dot gnu dot org
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-29 15:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from pinskia at gcc dot gnu dot org  2010-07-29 15:19 -------
*** Bug 45132 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |g_sauthoff at web dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2012-04-26 19:16 ` marc.glisse at normalesup dot org
@ 2012-04-26 21:05 ` nplatis at freemail dot gr
  12 siblings, 0 replies; 27+ messages in thread
From: nplatis at freemail dot gr @ 2012-04-26 21:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

--- Comment #25 from Nikos Platis <nplatis at freemail dot gr> 2012-04-26 21:02:36 UTC ---
The situation in the actual glm is more like the following. We also put t() and
f() in namespace glm as well, se we get the following code, which produces the
error:

namespace glm {
  namespace detail {
    struct dvec3{};
  }
  typedef detail::dvec3 vec3;
}

namespace glm {
    template<class T>
    int t(T i)
    {
    return f (i);
    }

    int f (glm::vec3 i)
    {
      return 0;
    }
}

int main()
{
  glm::vec3 b;
  return glm::t(b);
}


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2012-04-26 15:54 ` jason at gcc dot gnu.org
@ 2012-04-26 19:16 ` marc.glisse at normalesup dot org
  2012-04-26 21:05 ` nplatis at freemail dot gr
  12 siblings, 0 replies; 27+ messages in thread
From: marc.glisse at normalesup dot org @ 2012-04-26 19:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

Marc Glisse <marc.glisse at normalesup dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marc.glisse at normalesup
                   |                            |dot org

--- Comment #24 from Marc Glisse <marc.glisse at normalesup dot org> 2012-04-26 19:14:45 UTC ---
(In reply to comment #22)
> I am sorry if my knowledge on this issue is limited, but if I put t() and f()
> in namespace glm (re. the code in comment #20), should this compile? (That is
> what you comment #19 implies). Actually it does not.

So you are talking about this? Notice how vec3 isn't actually in glm.
Interactions between namespaces and name lookup can be difficult.

namespace glm {
  namespace detail {
    struct vec3{};
  }
  using detail::vec3;
}

template<class T>
int t(T i)
{
  return f (i);
}

namespace glm {
  int
    f (glm::vec3 i)
    {
      return 0;
    }
}

int main()
{
  glm::vec3 b;
  return t(b);
}


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2012-04-26 14:35 ` nplatis at freemail dot gr
@ 2012-04-26 15:54 ` jason at gcc dot gnu.org
  2012-04-26 19:16 ` marc.glisse at normalesup dot org
  2012-04-26 21:05 ` nplatis at freemail dot gr
  12 siblings, 0 replies; 27+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-26 15:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

--- Comment #23 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-26 15:51:35 UTC ---
(In reply to comment #22)
> I am sorry if my knowledge on this issue is limited, but if I put t() and f()
> in namespace glm (re. the code in comment #20), should this compile? (That is
> what you comment #19 implies). Actually it does not.

That's surprising, but I would need a self-contained testcase to comment
further.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2012-04-26 14:10 ` jason at gcc dot gnu.org
@ 2012-04-26 14:35 ` nplatis at freemail dot gr
  2012-04-26 15:54 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: nplatis at freemail dot gr @ 2012-04-26 14:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

--- Comment #22 from Nikos Platis <nplatis at freemail dot gr> 2012-04-26 14:33:45 UTC ---
I am sorry if my knowledge on this issue is limited, but if I put t() and f()
in namespace glm (re. the code in comment #20), should this compile? (That is
what you comment #19 implies). Actually it does not.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2012-04-25 17:34 ` nplatis at freemail dot gr
@ 2012-04-26 14:10 ` jason at gcc dot gnu.org
  2012-04-26 14:35 ` nplatis at freemail dot gr
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-26 14:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

--- Comment #21 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-26 14:09:14 UTC ---
(In reply to comment #20)
> glm::vec3 does not seem like a fundamental type.

It isn't, but its associated namespace is glm, and your f isn't in glm.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2011-09-26 17:40 ` jason at gcc dot gnu.org
@ 2012-04-25 17:34 ` nplatis at freemail dot gr
  2012-04-26 14:10 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: nplatis at freemail dot gr @ 2012-04-25 17:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

Nikos Platis <nplatis at freemail dot gr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nplatis at freemail dot gr

--- Comment #20 from Nikos Platis <nplatis at freemail dot gr> 2012-04-25 17:33:24 UTC ---
I am having a problem using code similar to the one in comment #5, but using
glm::vec3, from the glm library (http://glm.g-truc.net/), as the type used to
instanciate the template.

Then I get an error message that "‘f’ was not declared in this scope, and no
declarations were found by argument-dependent lookup at the point of
instantiation"

glm::vec3 does not seem like a fundamental type.


#include "glm/glm.hpp"

template<class T>
int t(T i)
{
  return f (i);
}

int
f (glm::vec3 i)
{
  return 0;
}

int
main()
{
  glm::vec3 b;
  return t(b);
}


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2011-05-20 19:24 ` jason at gcc dot gnu.org
@ 2011-09-26 17:40 ` jason at gcc dot gnu.org
  2012-04-25 17:34 ` nplatis at freemail dot gr
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: jason at gcc dot gnu.org @ 2011-09-26 17:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |phresnel at gmail dot com

--- Comment #19 from Jason Merrill <jason at gcc dot gnu.org> 2011-09-26 17:07:22 UTC ---
*** Bug 41995 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-05-20 18:36 ` jason at gcc dot gnu.org
@ 2011-05-20 19:24 ` jason at gcc dot gnu.org
  2011-09-26 17:40 ` jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-20 19:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #18 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-20 18:56:23 UTC ---
Fixed for 4.7.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-05-20 16:58 ` jason at gcc dot gnu.org
@ 2011-05-20 18:36 ` jason at gcc dot gnu.org
  2011-05-20 19:24 ` jason at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-20 18:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

--- Comment #17 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-20 18:01:27 UTC ---
Author: jason
Date: Fri May 20 18:01:22 2011
New Revision: 173965

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173965
Log:
    PR c++/24163
    PR c++/29131
gcc/cp/
    * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Avoid repeating
    unqualified lookup.
    * semantics.c (perform_koenig_lookup): Add complain parm.
    * cp-tree.h: Adjust.
    * parser.c (cp_parser_postfix_expression): Adjust.
    (cp_parser_perform_range_for_lookup): Adjust.
libstdc++-v3/
    * include/ext/pb_ds/assoc_container.hpp: Explicitly qualify calls to
    functions from dependent bases.
    * include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp: Likewise.
    * include/ext/pb_ds/detail/rb_tree_map_/
    split_join_fn_imps.hpp: Likewise.
    * include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp: Likewise.
    * include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp: Likewise.
    * include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp: Likewise.
    * include/ext/pb_ds/detail/splay_tree_/
    split_join_fn_imps.hpp: Likewise.
    * include/ext/pb_ds/detail/tree_policy/
    order_statistics_imp.hpp: Likewise.
    * include/ext/pb_ds/detail/trie_policy/
    prefix_search_node_update_imp.hpp: Likewise.
    * include/ext/rc_string_base.h: Likewise.
    * include/ext/rope: Likewise.
    * include/ext/ropeimpl.h: Likewise.
    * testsuite/util/exception/safety.h: Likewise.
    * testsuite/util/native_type/native_priority_queue.hpp: Likewise.
    * testsuite/util/testsuite_io.h: Likewise.
    * include/std/functional: Declare mem_fn earlier.
    * include/tr1/functional: Likewise.
    * include/tr1/exp_integral.tcc: Declare __expint_E1 earlier.

Added:
    trunk/gcc/testsuite/g++.dg/template/koenig9.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/opt/pr47615.C
    trunk/gcc/testsuite/g++.dg/overload/defarg1.C
    trunk/gcc/testsuite/g++.dg/tc1/dr213.C
    trunk/gcc/testsuite/g++.dg/torture/pr34850.C
    trunk/gcc/testsuite/g++.dg/torture/pr39362.C
    trunk/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C
    trunk/gcc/testsuite/g++.old-deja/g++.pt/memtemp47.C
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp
    trunk/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
   
trunk/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
    trunk/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
    trunk/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
    trunk/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
   
trunk/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
   
trunk/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
   
trunk/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
    trunk/libstdc++-v3/include/ext/rc_string_base.h
    trunk/libstdc++-v3/include/ext/rope
    trunk/libstdc++-v3/include/ext/ropeimpl.h
    trunk/libstdc++-v3/include/std/functional
    trunk/libstdc++-v3/include/tr1/exp_integral.tcc
    trunk/libstdc++-v3/include/tr1/functional
    trunk/libstdc++-v3/testsuite/util/exception/safety.h
    trunk/libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp
    trunk/libstdc++-v3/testsuite/util/testsuite_io.h


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-05-20 16:42 ` jason at gcc dot gnu.org
@ 2011-05-20 16:58 ` jason at gcc dot gnu.org
  2011-05-20 18:36 ` jason at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-20 16:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dave@boost-consulting.com

--- Comment #16 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-20 15:56:21 UTC ---
*** Bug 36883 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
  2010-10-18 20:28 ` pinskia at gcc dot gnu.org
  2011-05-05  0:59 ` redi at gcc dot gnu.org
@ 2011-05-20 16:42 ` jason at gcc dot gnu.org
  2011-05-20 16:58 ` jason at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-20 16:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
  2010-10-18 20:28 ` pinskia at gcc dot gnu.org
@ 2011-05-05  0:59 ` redi at gcc dot gnu.org
  2011-05-20 16:42 ` jason at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-05  0:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

--- Comment #15 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-05 00:58:04 UTC ---
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#225 is now NAD
(I think that should un-suspend several PRs)


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental types namespace for ADL.
       [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-18 20:28 ` pinskia at gcc dot gnu.org
  2011-05-05  0:59 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-10-18 20:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29131

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slyfox at inbox dot ru

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-10-18 20:27:20 UTC ---
*** Bug 46075 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2012-04-26 21:05 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-18 16:39 [Bug c++/29131] New: Bad name lookup for templates andrew dot stubbs at st dot com
2006-09-18 17:28 ` [Bug c++/29131] " pinskia at gcc dot gnu dot org
2006-09-19  3:47 ` pinskia at gcc dot gnu dot org
2006-09-19  3:49 ` pinskia at gcc dot gnu dot org
2006-09-19  3:51 ` pinskia at gcc dot gnu dot org
2006-09-19  4:06 ` pinskia at gcc dot gnu dot org
2006-09-19  4:30 ` [Bug c++/29131] [DR 225] " pinskia at gcc dot gnu dot org
2009-12-05  0:13 ` pinskia at gcc dot gnu dot org
2009-12-08 22:03 ` pinskia at gcc dot gnu dot org
2010-02-05 12:52 ` [Bug c++/29131] [DR 225] Bad name lookup for templates due to foundemtal types namespace for ADL paolo dot carlini at oracle dot com
2010-03-04 20:28 ` pinskia at gcc dot gnu dot org
2010-03-24 16:45 ` [Bug c++/29131] [DR 225] Bad name lookup for templates due to fundamental " pinskia at gcc dot gnu dot org
2010-03-29 20:53 ` pinskia at gcc dot gnu dot org
2010-07-29 15:20 ` pinskia at gcc dot gnu dot org
     [not found] <bug-29131-4@http.gcc.gnu.org/bugzilla/>
2010-10-18 20:28 ` pinskia at gcc dot gnu.org
2011-05-05  0:59 ` redi at gcc dot gnu.org
2011-05-20 16:42 ` jason at gcc dot gnu.org
2011-05-20 16:58 ` jason at gcc dot gnu.org
2011-05-20 18:36 ` jason at gcc dot gnu.org
2011-05-20 19:24 ` jason at gcc dot gnu.org
2011-09-26 17:40 ` jason at gcc dot gnu.org
2012-04-25 17:34 ` nplatis at freemail dot gr
2012-04-26 14:10 ` jason at gcc dot gnu.org
2012-04-26 14:35 ` nplatis at freemail dot gr
2012-04-26 15:54 ` jason at gcc dot gnu.org
2012-04-26 19:16 ` marc.glisse at normalesup dot org
2012-04-26 21:05 ` nplatis at freemail dot gr

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).