public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23698] New: [4.1 Regression] accepts invalid
@ 2005-09-02 15:41 pinskia at gcc dot gnu dot org
  2005-09-02 15:44 ` [Bug c++/23698] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-02 15:41 UTC (permalink / raw)
  To: gcc-bugs

The following code is accepted in 4.1 but should not be:
struct g   {
  bool operator==(const g& __arg) const;
};
template< typename T > struct is_integral {
  static const T value = false;
};
template <bool>   struct enable_if_c;
template<typename Functor> typename enable_if_c<(is_integral<Functor>::value)>::type 
operator==(const int& f, Functor g)   {
}
template<class D>     int get_deleter( g const & ti, g const & ti1 )     {
  return ti == ti1;
}

-- 
           Summary: [4.1 Regression] accepts invalid
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/23698] [4.1 Regression] accepts invalid
  2005-09-02 15:41 [Bug c++/23698] New: [4.1 Regression] accepts invalid pinskia at gcc dot gnu dot org
@ 2005-09-02 15:44 ` pinskia at gcc dot gnu dot org
  2005-09-02 15:47 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-02 15:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-02 15:44 -------
I should mention I found this while reducing PR 23691.

This has been failing since at least 4.1.0 20050808.

-- 


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


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

* [Bug c++/23698] [4.1 Regression] accepts invalid
  2005-09-02 15:41 [Bug c++/23698] New: [4.1 Regression] accepts invalid pinskia at gcc dot gnu dot org
  2005-09-02 15:44 ` [Bug c++/23698] " pinskia at gcc dot gnu dot org
@ 2005-09-02 15:47 ` pinskia at gcc dot gnu dot org
  2005-09-02 16:34 ` bangerth at dealii dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-02 15:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.0


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


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

* [Bug c++/23698] [4.1 Regression] accepts invalid
  2005-09-02 15:41 [Bug c++/23698] New: [4.1 Regression] accepts invalid pinskia at gcc dot gnu dot org
  2005-09-02 15:44 ` [Bug c++/23698] " pinskia at gcc dot gnu dot org
  2005-09-02 15:47 ` pinskia at gcc dot gnu dot org
@ 2005-09-02 16:34 ` bangerth at dealii dot org
  2005-09-02 16:39 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2005-09-02 16:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-09-02 16:33 -------
I think it can be considered arguable whether the code is valid or not. 
Here it is again: 
-------------------- 
template <typename T> struct X { 
    static const T value = false; 
}; 
 
template <bool> struct W {}; 
 
template <typename T> 
W<X<T>::value> 
operator== (int, T)   {} 
 
struct S { 
    bool operator== (const S&) const; 
}; 
 
S t1, t2; 
bool b = (t1 == t2); 
-------------------------- 
g/x> /home/bangerth/bin/gcc-4.1*/bin/c++ -c x.cc 
g/x> /home/bangerth/bin/gcc-4.0*/bin/c++ -c x.cc 
x.cc: In instantiation of &#8216;X<S>&#8217;: 
x.cc:16:   instantiated from here 
x.cc:2: error: conversion from &#8216;bool&#8217; to non-scalar type &#8216;S&#8217; requested 
x.cc:2: error: invalid in-class initialization of static data member of 
non-integral type &#8216;const S&#8217; 
 
The question is whether we have to instantiate X<S> at all if we can 
determine that we will not call ::operator==(int,T). 
 
W. 

-- 


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


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

* [Bug c++/23698] [4.1 Regression] accepts invalid
  2005-09-02 15:41 [Bug c++/23698] New: [4.1 Regression] accepts invalid pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-09-02 16:34 ` bangerth at dealii dot org
@ 2005-09-02 16:39 ` pinskia at gcc dot gnu dot org
  2005-09-15 22:14 ` janis at gcc dot gnu dot org
  2005-09-15 22:20 ` geoffk at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-02 16:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-02 16:38 -------
I should mention that comeau also rejects this and I would assume ICC does too.

-- 


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


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

* [Bug c++/23698] [4.1 Regression] accepts invalid
  2005-09-02 15:41 [Bug c++/23698] New: [4.1 Regression] accepts invalid pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-09-02 16:39 ` pinskia at gcc dot gnu dot org
@ 2005-09-15 22:14 ` janis at gcc dot gnu dot org
  2005-09-15 22:20 ` geoffk at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: janis at gcc dot gnu dot org @ 2005-09-15 22:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From janis at gcc dot gnu dot org  2005-09-15 22:14 -------
This changed with the following patch from geoffk:

  http://gcc.gnu.org/ml/gcc-cvs/2005-06/msg00723.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |geoffk at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/23698] [4.1 Regression] accepts invalid
  2005-09-02 15:41 [Bug c++/23698] New: [4.1 Regression] accepts invalid pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-09-15 22:14 ` janis at gcc dot gnu dot org
@ 2005-09-15 22:20 ` geoffk at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2005-09-15 22:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From geoffk at gcc dot gnu dot org  2005-09-15 22:20 -------
I think the relevant part of the C++ standard here is [temp.inst] paragraph 5:

If the overload resolution process can determine the correct function to call without instantiating a class 
template definition, it is unspecified whether that instantiation actually takes place.

-- 


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


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

* [Bug c++/23698] [4.1 Regression] accepts invalid
       [not found] <bug-23698-6528@http.gcc.gnu.org/bugzilla/>
@ 2005-10-13 19:23 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-13 19:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2005-10-13 19:23 -------
(In reply to comment #5)
> I think the relevant part of the C++ standard here is [temp.inst] paragraph 5:

So closing as invalid then.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2005-10-13 19:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-02 15:41 [Bug c++/23698] New: [4.1 Regression] accepts invalid pinskia at gcc dot gnu dot org
2005-09-02 15:44 ` [Bug c++/23698] " pinskia at gcc dot gnu dot org
2005-09-02 15:47 ` pinskia at gcc dot gnu dot org
2005-09-02 16:34 ` bangerth at dealii dot org
2005-09-02 16:39 ` pinskia at gcc dot gnu dot org
2005-09-15 22:14 ` janis at gcc dot gnu dot org
2005-09-15 22:20 ` geoffk at gcc dot gnu dot org
     [not found] <bug-23698-6528@http.gcc.gnu.org/bugzilla/>
2005-10-13 19:23 ` pinskia 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).