Bug 32058 - invalid computed void parameter in template
Summary: invalid computed void parameter in template
Status: RESOLVED DUPLICATE of bug 9278
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2007-05-23 17:29 UTC by Paul Doherty
Modified: 2007-05-24 03:12 UTC (History)
9 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Paul Doherty 2007-05-23 17:29:43 UTC
Can't return void from type function instantiation with dependent args for use in function declaration.

all versions from 3.4 to the latest 4.3.0 build on x86 cygwin/linux complain with:

error: invalid parameter type 'void'


template <int cond>
struct F { typedef void Type; };

template <int I>
struct X {

   // does not accept dependent computed type void!
   // (void* is fine as is non-dependent F<0>::Type)

   typedef typename F<I>::Type ParmT;

   static int func(ParmT) { return 1; }

int main()
   int i = X<0>::func();


The VisualC++ compilers are fine.
Comment 1 Andrew Pinski 2007-05-24 02:56:16 UTC
GCC is correct, this code is invalid C++. See PR 9278.

*** This bug has been marked as a duplicate of 9278 ***