public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31951]  New: local structure problem
@ 2007-05-16 12:55 ndbecker2 at gmail dot com
  2007-05-16 22:16 ` [Bug c++/31951] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ndbecker2 at gmail dot com @ 2007-05-16 12:55 UTC (permalink / raw)
  To: gcc-bugs

2nd call to partial_sort gives 'no match...' error, but 1st is OK.
Doesn't seem right.

#include <algorithm>
#include <vector>

template<typename vector_t>
 struct Sort_Func2  {
  vector_t const& mag;
  Sort_Func2 (vector_t const& _mag) : mag (_mag) {}
  bool operator() (int a, int b) const { return mag [a] < mag [b]; }
};

template<typename vector_t>
void F (vector_t const& v) {
  struct Sort_Func {
    vector_t const& mag;
    Sort_Func (vector_t const& _mag) : mag (_mag) {}
    bool operator() (int a, int b) const { return mag [a] < mag [b]; }
  };

  std::vector<int> indexes (v.size());
  std::partial_sort (indexes.begin(), indexes.begin()+2, indexes.end(),
Sort_Func2<vector_t> (v));
  std::partial_sort (indexes.begin(), indexes.begin()+2, indexes.end(),
Sort_Func (v));
}

int main() {
  std::vector<int> v;
  F (v);
}


-- 
           Summary: local structure problem
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ndbecker2 at gmail dot com


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


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

* [Bug c++/31951] local structure problem
  2007-05-16 12:55 [Bug c++/31951] New: local structure problem ndbecker2 at gmail dot com
@ 2007-05-16 22:16 ` pinskia at gcc dot gnu dot org
  2007-05-17 14:48 ` bangerth at dealii dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-16 22:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-05-16 23:16 -------
This is not a bug, local classes cannot be template arguments.


-- 


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


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

* [Bug c++/31951] local structure problem
  2007-05-16 12:55 [Bug c++/31951] New: local structure problem ndbecker2 at gmail dot com
  2007-05-16 22:16 ` [Bug c++/31951] " pinskia at gcc dot gnu dot org
@ 2007-05-17 14:48 ` bangerth at dealii dot org
  2009-10-05 14:42 ` dmitry at lsi dot upc dot edu
  2009-10-05 14:58 ` redi at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2007-05-17 14:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bangerth at dealii dot org  2007-05-17 15:48 -------
Indeed, like Andrew says.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/31951] local structure problem
  2007-05-16 12:55 [Bug c++/31951] New: local structure problem ndbecker2 at gmail dot com
  2007-05-16 22:16 ` [Bug c++/31951] " pinskia at gcc dot gnu dot org
  2007-05-17 14:48 ` bangerth at dealii dot org
@ 2009-10-05 14:42 ` dmitry at lsi dot upc dot edu
  2009-10-05 14:58 ` redi at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dmitry at lsi dot upc dot edu @ 2009-10-05 14:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dmitry at lsi dot upc dot edu  2009-10-05 14:42 -------
(In reply to comment #1)
> This is not a bug, local classes cannot be template arguments.
> 
What does prevent them to be?


-- 


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


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

* [Bug c++/31951] local structure problem
  2007-05-16 12:55 [Bug c++/31951] New: local structure problem ndbecker2 at gmail dot com
                   ` (2 preceding siblings ...)
  2009-10-05 14:42 ` dmitry at lsi dot upc dot edu
@ 2009-10-05 14:58 ` redi at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-10-05 14:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from redi at gcc dot gnu dot org  2009-10-05 14:58 -------
14.3.1 [temp.arg.type] paragraph 2 in the current C++ standard says:

    A type without linkage (3.5) shall not be used as a template argument for a
template type parameter. 

This is changing for C++0x, based on the proposal
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm


-- 


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


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

end of thread, other threads:[~2009-10-05 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-16 12:55 [Bug c++/31951] New: local structure problem ndbecker2 at gmail dot com
2007-05-16 22:16 ` [Bug c++/31951] " pinskia at gcc dot gnu dot org
2007-05-17 14:48 ` bangerth at dealii dot org
2009-10-05 14:42 ` dmitry at lsi dot upc dot edu
2009-10-05 14:58 ` redi 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).