This is the mail archive of the gcc-bugs@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++/7136: Template constants deduction


>Number:         7136
>Category:       c++
>Synopsis:       Template constants deduction
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 26 19:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     g++
>Release:        gcc version 2.95.4 20011006 (Debian prerelease)
>Organization:
>Environment:
Linux 2.2.19pre17 i686
>Description:
Pointer to member template constants are not properly resolved.  The compiler returns:

template.cpp:18: type/value mismatch at argument 2 in template parameter list for `template<_T, int _T::*<anonymous> > struct Number'
template.cpp:18:   expected a constant of type `int _T::*', got `int _T::*'
template.cpp:19: ISO C++ forbids declaration of `parameter' with no type
template.cpp: In function `int main()':
template.cpp:27: no matching function for call to `foo(Number<Type, &Type::i>)'
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="template.cpp"
Content-Disposition: inline; filename="template.cpp"

#include <iostream>

using namespace std;


struct Type
{
int i;
};

template <typename _T, int _T::*>
struct Number
{
};


template <typename _T, int _T::*>
void foo(Number<_T, int _T::*> const &)
{
cout << __PRETTY_FUNCTION__ << endl;
}



int main()
{
foo(Number<Type, & Type::i>());

return 0;
}



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