Bug 13166 - [DR136] not implemented
Summary: [DR136] not implemented
Status: RESOLVED DUPLICATE of bug 59480
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, monitored
Depends on:
Blocks: c++-friends, cxxfriends
  Show dependency treegraph
 
Reported: 2003-11-23 13:13 UTC by Rafael Ávila de Espíndola
Modified: 2018-09-19 17:11 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail: 3.3, 4.5.3, 4.8.3, 4.9.3, 5.3.0, 6.3.0, 7.0
Last reconfirmed: 2006-09-03 21:39:23


Attachments
the file that triggers the bug (143.70 KB, application/x-bzip2)
2003-11-23 13:16 UTC, Rafael Ávila de Espíndola
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Ávila de Espíndola 2003-11-23 13:13:43 UTC
The problem occurs while compiling systemc with gcc 3.4. It compiles normally with gcc 3.3 
The details: 
 
$gcc -v 
Reading specs from /home/rafael/gcc_main/lib/gcc/i686-pc-linux-gnu/3.4/specs 
Configured with: ../gcc_main/configure --prefix=/home/rafael/gcc_main --enable-languages=c,c++ 
Thread model: posix 
gcc version 3.4 20031122 (experimental) 
 
Command: 
 g++ -O3 -c sc_bv_base.ii 
 
g++ output: 
 g++ -O3 -c  src/systemc/datatypes/bit/sc_bv_base.ii  
In file included from ../../../../src/systemc/datatypes/bit/sc_proxy.h:51, 
                 from ../../../../src/systemc/datatypes/bit/sc_bit_proxies.h:41, 
                 from ../../../../src/systemc/datatypes/bit/sc_bv_base.h:41, 
                 from sc_bv_base.cpp:38: 
../../../../src/systemc/datatypes/int/sc_unsigned.h:1939: internal compiler error: Falha de segmentação 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Rafael Ávila de Espíndola 2003-11-23 13:16:17 UTC
Created attachment 5193 [details]
the file that  triggers the bug
Comment 2 Falk Hueffner 2003-11-23 14:54:42 UTC
Confirmed. Test case:

namespace sc_dt {
    class sc_length_param {
	friend int compare_unsigned(int if_v_signed = 0);
    };
}
Comment 3 Volker Reichelt 2003-12-03 22:33:18 UTC
Nathan's patch for PR 9162

http://gcc.gnu.org/ml/gcc-cvs/2003-07/msg00137.html

caused the regression.
Comment 4 GCC Commits 2003-12-05 14:45:05 UTC
Subject: Bug 13166

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	lerdsuwa@gcc.gnu.org	2003-12-05 14:45:00

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/parse: defarg6.C 

Log message:
	PR c++/13166
	* parser.c (cp_parser_late_parsing_default_args): Make sure the
	context is a class before calling push_nested_class and
	pop_nested_class.
	
	* g++.dg/parse/defarg6.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3781&r2=1.3782
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.126&r2=1.127
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3230&r2=1.3231
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/defarg6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 5 Kriang Lerdsuwanakij 2003-12-05 14:49:03 UTC
The regression is fixed in the mainline.  So it no longer ICE.
However the behavior mentioned in DR136 (limiting which friend
declaration can have default function argument) is not yet implemented.
So I keep this bug report open, change keywords into an accept-invalid
and adjust the summary accordingly.
Comment 6 Kriang Lerdsuwanakij 2005-10-22 13:57:23 UTC
Won't work on it for a long while.
Comment 7 Oliver Freyermuth 2014-01-07 10:08:20 UTC
I can still see [DR136] not being implemented in gcc version 4.8.2 , as I just noticed some code not compiling anymore with recent Clang 3.4 which by now implemented DR136: http://llvm.org/viewvc/llvm-project?view=revision&revision=184889 . 
g++ still compiles it fine although DR136 is violated (code in question is e.g. string.h of commoncpp2-1.8.0 ).
Comment 8 Martin Sebor 2017-01-11 22:36:01 UTC
GCc 7.0 still accepts the small test case from comment #2.  Clang rejects it with:

t.C:4:13: error: friend declaration specifying a default argument must be a
      definition
        friend int compare_unsigned(int if_v_signed = 0);
                   ^
1 error generated.
Comment 9 Volker Reichelt 2018-09-19 17:11:41 UTC
Fixed by Paolo's patches for PR59480.

*** This bug has been marked as a duplicate of bug 59480 ***