------- Comment #5 from bangerth at dealii dot org  2005-11-08 05:14 -------
This can of course be made even simpler:
----------------
struct A {
    template<int i> A(int (*)[i]) : j(i) {}
    int * i;
    int   j;
};

int i[3];
A a(&i);
----------------

g/x> /home/bangerth/bin/gcc-3.4.5-pre/bin/c++ -c x.cc
x.cc: In constructor `A::A(int (*)[i]) [with int i = 3]':
x.cc:8:   instantiated from here
x.cc:2: error: invalid conversion from `int*' to `int'

I'm pretty sure I've seen this somewhere before -- the question was indeed
which name should be looked up, the template name or the name of a member
variable.

In any case, the error message is not particularly helpful, and I know of
at least one other compiler that accepts this.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-11-08 05:14:36
               date|                            |


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

Reply via email to