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

[C++ PATCH] [PR17232] Trigger implicit instantiation when creating an array type


Hello,

calling a function with this signature:

template <class T> void foo(T (*)[2]);

should require T to be complete to check for its semantic constraints: DR 337
clarified that an instantiation should fail if it creates a array type whose
elements are of abstract type, and to check whether a type is abstract or not
we need it to be complete. This is also backed by [temp.inst]/4 which says that
an implicit instantiation should happen whenever the completeness of the class
type affects the semantic of the program.

Notice that, FWIW, EDG does not complete type T. In fact, it allows to call the
above function with T being abstract, and only when (if) the array is accessed
it emits an error. I do not think this behaviour is standard conformant: the
call to foo<A> with A abstract should be forbidden, so that additional
overloads of foo can come into play.

Tested on i686-pc-linux-gnu, OK for mainline?

Giovanni Bajo

Attachment: patch-pr17232.txt
Description: Text document


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