c++/1738: template function with volatile formal parameter confuses compiler

mps@sonartech.com.au mps@sonartech.com.au
Mon Jan 22 18:56:00 GMT 2001


>Number:         1738
>Category:       c++
>Synopsis:       template function with volatile formal parameter confuses compiler
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 22 18:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Michael Shepanski
>Release:        2.95.2 19991024
>Organization:
>Environment:
AIX power-pc
>Description:
template <class T>
void f (volatile T x)  {}

main ()
{
    volatile int *vip = 0;
    // the following instantiation of f should
    // have T="int *", and therefore have a
    // formal parameter type of "volatile int *",
    // which matches the actual parameter.
    // So why does g++ reject it?
    f<int *> (vip);
}
>How-To-Repeat:
Compile the code given in the "Description:" box.
>Fix:
Please
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-bugs mailing list