Bug 30344 - template type argument cannot be initialized by a default parameter
Summary: template type argument cannot be initialized by a default parameter
Status: RESOLVED DUPLICATE of bug 57
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-01 18:56 UTC by Bernd Donner
Modified: 2007-01-01 19:02 UTC (History)
20 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernd Donner 2007-01-01 18:56:10 UTC
The following code sample is compiled by several other compilers. Gcc compiles the following example, when the function f is put into the global scope.
The example can also be compiled, when v has only a single template parameter.



template <class T1, class T2>
class v { };

class c2 {
    void f(const v<int, int> &t = v<int, int>()) { }
};

int main() { }



The code cannot be compiled by gcc 3.4, 4.1.2 and 4.2
In the example it is of course essential that t is a _constant_ reference.

Bernd Donner
Comment 1 Andrew Pinski 2007-01-01 19:02:21 UTC

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