This is the mail archive of the gcc-patches@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++ Patch/RFC PR c++/57887 (and dups)


Hi,

we are getting bug reports about this issue with NSDMIs in template classes, like:

struct B
{
template<int N>
struct A
{
int X = N;
};
};

57887.C:6:13: error: ‘N’ was not declared in this scope

Looking at cp_parser_class_specifier_1, the comments about the late parsing of default arguments (which we are already handling correctly):

/* Make sure that any template parameters are in scope. */
maybe_begin_member_template_processing (decl);

it seems clear to me that something very similar must be done for NSDMIs too. Thus I prepared the below, which uses CLASSTYPE_TEMPLATE_INFO to adapt the existing code in maybe_begin_member_template_processing. It tests fine. How does it look?

Thanks!
Paolo.

///////////////////////

Attachment: patch_57887
Description: Text document


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