public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18674] New: G++ accepts bad elaborated type specifiers
@ 2004-11-25 14:18 gcc-bugzilla at gcc dot gnu dot org
  2004-11-25 14:22 ` [Bug c++/18674] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-11-25 14:18 UTC (permalink / raw)
  To: gcc-bugs



elaborated-type-speficier:
  class-key ::? nested-name-specifier? identifier
  class-key ::? nested-name-specifier? template? template-id
  enum ::? nested-name-specifier? identifier
  typename ::? nested-name-specifier? identifier
  typename ::? nested-name-specifier? template? template-id

According to the paragraph 7.1.5.3.3 of the standard, the three first
rules need to refer to class, union, or enum depending on the first
keyword. But gcc accepts it to be used whenever you want.

Environment:
System: Linux nostromo 2.4.27-1-686 #1 Fri Sep 3 06:28:00 UTC 2004 i686 GNU/Linux
Architecture: i686

	
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,objc,ada --prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --enable-nls --enable-threads=posix --without-included-gettext --disable-werror --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk i486-linux-gnu

How-To-Repeat:

The command line used was:
g++-snapshot -std=c++98 -pedantic -W -Wall -c e.cc

The following source file is invalid but gcc do not say anything:
template <typename I>
static void g() {
  enum I::t a;
  (void) a;
}

struct B {
  typedef int t;
};

void h()
{
  g<B>();
}

-- 
           Summary: G++ accepts bad elaborated type specifiers
           Product: gcc
           Version: 0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: valentin at lrde dot epita dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18674


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/18674] [3.4/4.0 Regression] G++ accepts bad elaborated type specifiers
  2004-11-25 14:18 [Bug c++/18674] New: G++ accepts bad elaborated type specifiers gcc-bugzilla at gcc dot gnu dot org
@ 2004-11-25 14:22 ` pinskia at gcc dot gnu dot org
  2004-11-27  2:46 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-25 14:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-25 14:22 -------
Confirmed:
: Search converges between 2003-08-12-trunk (#321) and 2003-08-13-trunk (#322).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
   Last reconfirmed|0000-00-00 00:00:00         |2004-11-25 14:22:01
               date|                            |
            Summary|G++ accepts bad elaborated  |[3.4/4.0 Regression] G++
                   |type specifiers             |accepts bad elaborated type
                   |                            |specifiers
   Target Milestone|---                         |3.4.4
            Version|0.0                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18674


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/18674] [3.4/4.0 Regression] G++ accepts bad elaborated type specifiers
  2004-11-25 14:18 [Bug c++/18674] New: G++ accepts bad elaborated type specifiers gcc-bugzilla at gcc dot gnu dot org
  2004-11-25 14:22 ` [Bug c++/18674] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-11-27  2:46 ` pinskia at gcc dot gnu dot org
  2004-11-27 17:47 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-27  2:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-27 02:45 -------
This came in with the two pass namelookup.  The problem I think is that we don't mark a as only 
accepting enums so we don't get an error but I could be wrong.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18674


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/18674] [3.4/4.0 Regression] G++ accepts bad elaborated type specifiers
  2004-11-25 14:18 [Bug c++/18674] New: G++ accepts bad elaborated type specifiers gcc-bugzilla at gcc dot gnu dot org
  2004-11-25 14:22 ` [Bug c++/18674] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
  2004-11-27  2:46 ` pinskia at gcc dot gnu dot org
@ 2004-11-27 17:47 ` mmitchel at gcc dot gnu dot org
  2004-11-29 20:11 ` cvs-commit at gcc dot gnu dot org
  2004-11-29 20:23 ` [Bug c++/18674] [3.4 " mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-27 17:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18674


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/18674] [3.4/4.0 Regression] G++ accepts bad elaborated type specifiers
  2004-11-25 14:18 [Bug c++/18674] New: G++ accepts bad elaborated type specifiers gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-11-27 17:47 ` mmitchel at gcc dot gnu dot org
@ 2004-11-29 20:11 ` cvs-commit at gcc dot gnu dot org
  2004-11-29 20:23 ` [Bug c++/18674] [3.4 " mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-29 20:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-11-29 20:10 -------
Subject: Bug 18674

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-11-29 20:10:18

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog cp-tree.def cp-tree.h decl.c error.c 
	                 friend.c parser.c pt.c 
	gcc/testsuite/g++.old-deja/g++.brendan: crash16.C 
	gcc/testsuite/g++.old-deja/g++.law: ctors5.C 
	gcc/testsuite/g++.old-deja/g++.other: crash25.C 
Added files:
	gcc/testsuite/g++.dg/template: error16.C crash29.C 

Log message:
	PR c++/18368
	* parser.c (cp_parser_check_for_definition_in_return_type): Take
	the defined type as a parameter, and inform the user about the
	possibility of a missing semicolon.
	(cp_parser_explicit_instantiation): Adjust call to
	cp_parser_check_for_definition_in_return_type.
	(cp_parser_init_declarator): Likewise.
	(cp_parser_member_declaration): Likewise.
	
	PR c++/18674
	* cp-tree.def (TYPENAME_TYPE): Remove discussion of implicit
	typename from comments.
	* cp-tree.h (TYPENAME_IS_ENUM_P): New macro.
	(TYPENAME_IS_CLASS_P): Likewise.
	(make_typename_type): Change prototype.
	* decl.c (struct_typename_info): New type.
	(typename_compare): Expect the second argument to be a
	typename_info, not a tree.
	(build_typename_type): Add tag_type parameter.  Do not create a
	new type until necessary.
	(make_typename_type): Add tag_type parameter.
	* error.c (TYPENAME_TYPE): Print tags other than "typename" if
	appropriate.
	* friend.c (make_friend_class): Adjust call to make_typename_type.
	* parser.c (cp_parser_make_typename_type): Likewise.
	(cp_parser_primary_expression): Adjust call to
	cp_parser_lookup_name.
	(cp_parser_unqualified_id): Adjust calls to cp_parser_class_name.
	(cp_parser_class_or_namespace_name): Likewise.
	(cp_parser_postfix_expression): Adjust calls to
	make_typename_type.
	(cp_parser_mem_initializer_id): Adjust calls to
	cp_parser_class_name.
	(cp_parser_type_parameter): Adjust calls to cp_parser_lookup_name.
	(cp_parser_template_name): Likewise.
	(cp_parser_template_argument): Likewise.
	(cp_parser_type_name): Adjust call to cp_parser_class_name.
	(cp_parser_elaborated_type_specifier): Adjust calls to
	make_typename_type and cp_parser_lookup_name.
	(cp_parser_namespace_name): Likewise.
	(cp_parser_class_name): Replace type_p parameter with tag_type.
	Adjust calls to make_typename_type and cp_parser_lookup_name.
	(cp_parser_class_head): Adjust calls to cp_parser_class_name.
	(cp_parser_base_specifier): Likewise.
	(cp_parser_lookup_name): Replace is_type parameter with tag_type.
	Adjust calls to make_typename_type and lookup_qualified_name.
	(cp_parser_lookup_name_simple): Adjust call to
	cp_parser_lookup_name.
	(cp_parser_constructor_declarator_p): Adjust call to
	cp_parser_class_name.
	* pt.c (convert_template_argument): Adjust all to
	make_typename_type.
	(tsubst_decl): Do not pre-substitute the type of the declaration.
	(tsubst): Hand off declarations more quickly.  Adjust call to
	make_typename_type.
	
	PR c++/18512
	* parser.c (cp_parser_postfix_dot_deref_expression): Robustify.
	
	PR c++/18674
	* g++.old-deja/g++.brendan/crash16.C: Adjust error messages.
	* g++.old-deja/g++.law/ctors5.C: Likewise.
	* g++.old-deja/g++.other/crash25.C: Likewise.
	
	PR c++/18674
	* g++.dg/template/error16.C: New test.
	
	PR c++/18512
	* g++.dg/template/crash29.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4679&r2=1.4680
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error16.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash29.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4504&r2=1.4505
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.def.diff?cvsroot=gcc&r1=1.90&r2=1.91
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1076&r2=1.1077
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1336&r2=1.1337
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.272&r2=1.273
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/friend.c.diff?cvsroot=gcc&r1=1.102&r2=1.103
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.283&r2=1.284
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.951&r2=1.952
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C.diff?cvsroot=gcc&r1=1.5&r2=1.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.law/ctors5.C.diff?cvsroot=gcc&r1=1.5&r2=1.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/crash25.C.diff?cvsroot=gcc&r1=1.6&r2=1.7



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18674


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/18674] [3.4 Regression] G++ accepts bad elaborated type specifiers
  2004-11-25 14:18 [Bug c++/18674] New: G++ accepts bad elaborated type specifiers gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-11-29 20:11 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-29 20:23 ` mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-29 20:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-11-29 20:22 -------
Fixed in 4.0.  

Will not be fixed in 3.4.x, due to invasive nature of patch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|[3.4/4.0 Regression] G++    |[3.4 Regression] G++ accepts
                   |accepts bad elaborated type |bad elaborated type
                   |specifiers                  |specifiers
   Target Milestone|3.4.4                       |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18674


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-11-29 20:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-25 14:18 [Bug c++/18674] New: G++ accepts bad elaborated type specifiers gcc-bugzilla at gcc dot gnu dot org
2004-11-25 14:22 ` [Bug c++/18674] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-11-27  2:46 ` pinskia at gcc dot gnu dot org
2004-11-27 17:47 ` mmitchel at gcc dot gnu dot org
2004-11-29 20:11 ` cvs-commit at gcc dot gnu dot org
2004-11-29 20:23 ` [Bug c++/18674] [3.4 " mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).