aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorSimon Martin <simartin@users.sourceforge.net>2007-06-07 19:59:33 +0000
committerSimon Martin <simartin@gcc.gnu.org>2007-06-07 19:59:33 +0000
commitc1ae8be51fb22104066600fdddeaf94b004e63c8 (patch)
treec9bfce8481cc2ab5d947f7ccd7de24217b53132e /gcc/cp/pt.c
parent20967296dc0517322a6058ec55491de9707c0c34 (diff)
downloadgcc-c1ae8be51fb22104066600fdddeaf94b004e63c8.zip
gcc-c1ae8be51fb22104066600fdddeaf94b004e63c8.tar.gz
gcc-c1ae8be51fb22104066600fdddeaf94b004e63c8.tar.bz2
re PR c++/30759 (initializer-list accepted for object of non-POD type)
gcc/ 2007-06-07 Simon Martin <simartin@users.sourceforge.net> PR c++/30759 * c-common.h (flag_cpp0x): Replaced by... (cxx_dialect): ... this new variable specifying the C++ dialect that is used. * c-common.c (flag_cpp0x): Removed. (cxx_dialect): Defined. * c-cppbuiltin.c (c_cpp_builtins): flag_cpp0x rewritten in terms of cxx_dialect. * c-opts.c (c_common_post_options): Likewise. (set_std_cxx98): Set cxx_dialect to cxx98. (set_std_cxx0x): Set cxx_dialect to cxx0x. gcc/cp/ 2007-06-07 Simon Martin <simartin@users.sourceforge.net> PR c++/30759 * decl.c (check_initializer): Report an error when a brace enclosed initializer is used for a non-aggregate type in C++98. (redeclaration_error_message): Rewrote flag_cpp0x in terms of cxx_dialect. (grokdeclarator): Likewise. (move_fn_p): Likewise. * typeck.c (check_return_expr): Likewise. * call.c (reference_binding): Likewise. * error.c (cp_cpp_error): Likewise. * pt.c (check_default_tmpl_args): Likewise. (tsubst): Likewise. * lex.c (init_reswords): Likewise. * parser.c (p_parser_primary_expression): Likewise. (TOKEN_PRECEDENCE): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_ptr_operator): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_enclosed_template_argument_list): Likewise. (cp_parser_skip_to_end_of_template_parameter_list): Likewise. (cp_parser_next_token_ends_template_argument_p): Likewise. gcc/testsuite/ 2007-06-07 Simon Martin <simartin@users.sourceforge.net> PR c++/30759 * g++.dg/init/brace6.C: New test. From-SVN: r125539
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 47f3c0d..f3210dd 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3447,7 +3447,7 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary,
/* Core issue 226 (C++0x only): the following only applies to class
templates. */
- if (!flag_cpp0x || TREE_CODE (decl) != FUNCTION_DECL)
+ if ((cxx_dialect == cxx98) || TREE_CODE (decl) != FUNCTION_DECL)
{
/* [temp.param]
@@ -3482,7 +3482,7 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary,
}
}
- if ((!flag_cpp0x && TREE_CODE (decl) != TYPE_DECL)
+ if (((cxx_dialect == cxx98) && TREE_CODE (decl) != TYPE_DECL)
|| is_partial
|| !is_primary
|| is_friend_decl)
@@ -3510,7 +3510,7 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary,
msg = "default template arguments may not be used in function template friend re-declaration";
else if (is_friend_decl)
msg = "default template arguments may not be used in function template friend declarations";
- else if (TREE_CODE (decl) == FUNCTION_DECL && !flag_cpp0x)
+ else if (TREE_CODE (decl) == FUNCTION_DECL && (cxx_dialect == cxx98))
msg = "default template arguments may not be used in function templates";
else if (is_partial)
msg = "default template arguments may not be used in partial specializations";
@@ -8736,7 +8736,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
during instantiation is no longer a cause for failure. We
only enforce this check in strict C++98 mode. */
if ((TREE_CODE (type) == REFERENCE_TYPE
- && ((!flag_cpp0x && flag_iso) || code != REFERENCE_TYPE))
+ && (((cxx_dialect == cxx98) && flag_iso) || code != REFERENCE_TYPE))
|| (code == REFERENCE_TYPE && TREE_CODE (type) == VOID_TYPE))
{
static location_t last_loc;
@@ -11537,9 +11537,9 @@ type_unification_real (tree tparms,
If a template argument has not been deduced, its
default template argument, if any, is used.
- When we are not in C++0x mode (i.e., !flag_cpp0x),
- TREE_PURPOSE will either be NULL_TREE or ERROR_MARK_NODE,
- so we do not need to explicitly check flag_cpp0x here. */
+ When we are in C++98 mode, TREE_PURPOSE will either
+ be NULL_TREE or ERROR_MARK_NODE, so we do not need
+ to explicitly check cxx_dialect here. */
if (TREE_PURPOSE (TREE_VEC_ELT (tparms, i)))
{
tree arg = tsubst (TREE_PURPOSE (TREE_VEC_ELT (tparms, i)),