This is the mail archive of the gcc@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]

Re: g++ does not honour "explicit" keyword in all cases?


On Wed, 29 Oct 2003, Gabriel Dos Reis wrote:

> Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
>
> | Hi!
> |
> | Shouldnt g++ reject the following code, following 12.3.2?
> |
> | struct Foo {
> |    template <class T>
> |    explicit Foo(const T&) {}
> | };
> |
> | template <class T>
> | struct Bar {
> |    static T bar() { return 1; }
> | };
> |
> | void foo(void)
> | {
> |   Bar<double>::bar();
> | }
>
> Hm, I guess there is something I'm missing here.  From the definition
> of Bar<double>::bar, the return type is double and there is no mention
> of Foo, so I can't see what is wrong with the code.

Whoops, of course you are right. I meant actually Bar<Foo>::bar(); but
that does produce a diagnostic as expected. Back to the original
failure...

Richard.


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