http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56953
Bug #: 56953
Summary: [4.9]Inheriting constructors triggers instantiation of
parameters at point of declaration
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 29871
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29871
Testcase
I am using:
g++-snapshot (Debian 20130330-1) 4.9.0 20130330 (experimental) [trunk revision
197260]
According to the diagnostic GCC gives, in some cases a using declaration that
bring constructors into scope also triggers the instantiation of their
parameters.
The attachment is an example where a parameter takes the form
`requires_complete<completed_later>`, where specializations of
`requires_complete` are only valid when the template argument is complete. When
inheriting a constructor taking such a parameter, GCC complains about an
ill-formed specialization and points to the using declaration as having
triggered the instantiation. This is regardless of the program using that
constructor or not.
I believe the equivalent program which doesn't use inheriting constructors is
correct, as the instantiation takes place at the point of use and not the point
of declaration, where the argument `completed_later` is completed. At the very
least it is accepted by GCC (changing the define at the top of the file
controls that).
Do note that if `requires_complete` is itself left incomplete and not defined
until later in the program, then GCC accepts the program. Presumably those
parameters that are not themselves complete are not instantiated.
The same happens using a snapshot of pre-release 4.8.