pt.c (convert_nontype_argument): STRIP_NOPS where appropriate.

Thu Mar 26 10:25:52 1998  Mark Mitchell  <mmitchell@usa.net>
	* pt.c (convert_nontype_argument): STRIP_NOPS where appropriate.

From-SVN: r18841
This commit is contained in:
Mark Mitchell 1998-03-26 10:32:04 +00:00 committed by Mark Mitchell
parent 00459c3ad1
commit 49bf0d6f80
3 changed files with 36 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Thu Mar 26 10:25:52 1998 Mark Mitchell <mmitchell@usa.net>
* pt.c (convert_nontype_argument): STRIP_NOPS where appropriate.
Thu Mar 26 10:24:05 1998 Mark Mitchell <mmitchell@usa.net>
* call.c (build_object_call): Complain about ambiguous operator(),

View File

@ -1861,8 +1861,10 @@ convert_nontype_argument (type, expr)
|| expr_type == unknown_type_node)
{
tree referent;
tree e = expr;
STRIP_NOPS (e);
if (TREE_CODE (expr) != ADDR_EXPR)
if (TREE_CODE (e) != ADDR_EXPR)
{
bad_argument:
cp_error ("`%E' is not a valid template argument", expr);
@ -1874,7 +1876,7 @@ convert_nontype_argument (type, expr)
return NULL_TREE;
}
referent = TREE_OPERAND (expr, 0);
referent = TREE_OPERAND (e, 0);
STRIP_NOPS (referent);
if (TREE_CODE (referent) == STRING_CST)

View File

@ -0,0 +1,28 @@
// Build don't link:
enum E { e };
template <const E* ep>
struct S1
{
static char* s;
};
template <int D>
struct S2 {};
template <>
struct S2<1>
{
static E es[1];
};
struct S3
{
typedef S1<S2<1>::es> S3_Type;
};
E S2<1>::es[1] = {e};
template <>
char* S1<S2<1>::es>::s = "abc";