This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16319] New: Template behaves differently with pointers depending on their source


The following code does not compile with gcc version 

   [nlgn][~/source/saclib++/test]$ gcc -v
   Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
   Configured with: ../gcc-3.3.1/configure
   Thread model: posix
   gcc version 3.3.1

and I'm almost positive it should.  (For the next time, is there a place to ask
about if something might be a bug before reporting it?)

Code:

template<typename T>
struct holder{
   
   holder(T &t):t_(t){};
   
   T t_; 
   
};

int main(){
   int *a = new int[10];
   int *front_of_a = &a[0];
   
   holder<int*> h1(a);
   holder<int*> h2(front_of_a);

   //below does not compile
      holder<int*> h3(&a[0]);

}//main

-- 
           Summary: Template behaves differently with pointers depending on
                    their source
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dgr24 at drexel dot edu
                CC: dgr24 at drexel dot edu,gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]