aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-10-31 22:04:30 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-10-31 22:04:30 -0400
commit202be748c9997016f1b08c98291db4b7b9b02a5f (patch)
treec73ec826bca2bbeb958764d2f9c5023a3d3a4ad4 /gcc/cp
parente2c50b7eeec3a51e080e80d0492250f7fd86770c (diff)
downloadgcc-202be748c9997016f1b08c98291db4b7b9b02a5f.zip
gcc-202be748c9997016f1b08c98291db4b7b9b02a5f.tar.gz
gcc-202be748c9997016f1b08c98291db4b7b9b02a5f.tar.bz2
decl.c (grokdeclarator): Don't ICE on constexpr non-static data member.
* decl.c (grokdeclarator): Don't ICE on constexpr non-static data member. * parser.c (cp_parser_diagnose_invalid_type_name): Give helpful message about constexpr without -std=c++0x. From-SVN: r166122
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/cp/parser.c7
3 files changed, 18 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8df704f..1a8837c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2010-10-31 Jason Merrill <jason@redhat.com>
+
+ * parser.c (cp_parser_diagnose_invalid_type_name): Give helpful
+ message about constexpr without -std=c++0x.
+
+ * decl.c (grokdeclarator): Don't ICE on constexpr non-static data
+ member.
+
2010-10-30 Nathan Froyd <froydnj@codesourcery.com>
* class.c (layout_vtable_decl): Call build_array_of_n_type.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d73d109..dfe37d9 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9652,8 +9652,11 @@ grokdeclarator (const cp_declarator *declarator,
else
{
if (constexpr_p)
- error ("non-static data member %qE declared %<constexpr%>",
- unqualified_id);
+ {
+ error ("non-static data member %qE declared %<constexpr%>",
+ unqualified_id);
+ constexpr_p = false;
+ }
decl = build_decl (input_location,
FIELD_DECL, unqualified_id, type);
DECL_NONADDRESSABLE_P (decl) = bitfield;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 851e9c4..33d8561 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2698,8 +2698,11 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
template <typename T> struct B : public A<T> { X x; };
The user should have said "typename A<T>::X". */
- if (processing_template_decl && current_class_type
- && TYPE_BINFO (current_class_type))
+ if (cxx_dialect < cxx0x && id == ridpointers[(int)RID_CONSTEXPR])
+ inform (location, "C++0x %<constexpr%> only available with "
+ "-std=c++0x or -std=gnu++0x");
+ else if (processing_template_decl && current_class_type
+ && TYPE_BINFO (current_class_type))
{
tree b;