public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16777] New: C++ parse error in 3.3, OK in 3.2 and 3.4
@ 2004-07-27 3:16 lindahl at pathscale dot com
2004-07-27 3:27 ` [Bug c++/16777] [3.3 Regression] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: lindahl at pathscale dot com @ 2004-07-27 3:16 UTC (permalink / raw)
To: gcc-bugs
Reading specs from /usr/lib/gcc-lib/x86_64-redhat-linux/3.3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=x86_64-redhat-linux
Thread model: posix
gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1)
This is OK in gcc 3.2, broken in gcc 3.3 (e.g. 3.3.2 from redhat), ok in gcc 3.4.0
g++ -c test4a.cc
test4a.cc: In member function `AttributeT<char*, int>*
AttrManager::NewUserAttribute(const char*, const VcbSearchSet&)':
test4a.cc:40: error: `NewAttribute<char*, int>' undeclared (first use this
function)
test4a.cc:40: error: (Each undeclared identifier is reported only once for each
function it appears in.)
-----test4a.cc-----------------------------------------------------------------
#define NULL 0x00000000
class AttrManager;
static AttrManager* attr_manager;
template <class T, class Obj>
class AttributeT {
public:
int x;
};
class VcbSearchSet {
public:
VcbSearchSet(void*);
};
class AttrManager {
public:
AttrManager();
~AttrManager();
template <class T, class Obj>
AttributeT<T, Obj>* NewAttribute(const char* name, int vm,
const char* help, const VcbSearchSet& vcbs,
T (*default_value_function) (),
int (*check_obj_and_value_function) (Obj*,T)
)
{
return NULL;
}
AttributeT<char*, int>* AttrManager::NewUserAttribute(const char* name,
const VcbSearchSet& vcbs)
{
int avm_user = 1;
return attr_manager->
AttrManager::NewAttribute<char*, int>(name, avm_user,
"user defined", vcbs, NULL, NULL);
}
};
----------------------------------------------------------------------
funky attempts to cast the NULL don't help: (and shouldn't be needed)
----------------------------------------------------------------------
This shows a workaround, remove the AttrManager:: in the call
----------------------------------------------------------------------
g++ -c test4b.cc
-----test4b.cc-----------------------------------------------------------------
#define NULL 0x00000000
class AttrManager;
static AttrManager* attr_manager;
template <class T, class Obj>
class AttributeT {
public:
int x;
};
class VcbSearchSet {
public:
VcbSearchSet(void*);
};
class AttrManager {
public:
AttrManager();
~AttrManager();
template <class T, class Obj>
AttributeT<T, Obj>* NewAttribute(const char* name, int vm,
const char* help, const VcbSearchSet& vcbs,
T (*default_value_function) (),
int (*check_obj_and_value_function) (Obj*,T)
)
{
return NULL;
}
AttributeT<char*, int>* AttrManager::NewUserAttribute(const char* name,
const VcbSearchSet& vcbs)
{
int avm_user = 1;
return attr_manager->
NewAttribute<char*, int>(name, avm_user,
"user defined", vcbs, (char*(*)())NULL, (int(*)(int*,char*))NULL);
}
};
----------------------------------------------------------------------
--
Summary: C++ parse error in 3.3, OK in 3.2 and 3.4
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lindahl at pathscale dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16777
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/16777] [3.3 Regression] C++ parse error in 3.3, OK in 3.2 and 3.4
2004-07-27 3:16 [Bug c++/16777] New: C++ parse error in 3.3, OK in 3.2 and 3.4 lindahl at pathscale dot com
@ 2004-07-27 3:27 ` pinskia at gcc dot gnu dot org
2004-07-27 3:38 ` [Bug c++/16777] [3.3 Regression] Trouble with qualified declaration in class bangerth at dealii dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-27 3:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-27 03:27 -------
Confirmed, I think this is just the parser not being able to handle template right, in previous versions
of gcc before 3.3, it used to add the template keyword for you sometimes but in 3.3 we removed that
extension which broke a couple of things, this example included. Now in 3.4.0 we fixed this by
rewriting the parser so it would find the places where you do not need (and cannot, this is an example
of where you cannot use the template keyword) to use the template keyword.
This is almost an example of where we cannot fix 3.3.x at all.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |gdr at gcc dot gnu dot org
Severity|normal |minor
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |rejects-valid
Last reconfirmed|0000-00-00 00:00:00 |2004-07-27 03:27:56
date| |
Summary|C++ parse error in 3.3, OK |[3.3 Regression] C++ parse
|in 3.2 and 3.4 |error in 3.3, OK in 3.2 and
| |3.4
Target Milestone|--- |3.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16777
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/16777] [3.3 Regression] Trouble with qualified declaration in class
2004-07-27 3:16 [Bug c++/16777] New: C++ parse error in 3.3, OK in 3.2 and 3.4 lindahl at pathscale dot com
2004-07-27 3:27 ` [Bug c++/16777] [3.3 Regression] " pinskia at gcc dot gnu dot org
@ 2004-07-27 3:38 ` bangerth at dealii dot org
2004-07-27 3:43 ` lindahl at pathscale dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-07-27 3:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-07-27 03:38 -------
That's actually a strange piece of code:
-------------------
struct X {
template <typename> void foo();
void X::bar() {
this->X::foo<int>();
}
};
-------------------
gcc 3.2, 3.4 and mainline actually accept the odd declaration using the
qualification X:: of the member function, whereas 3.3 somehow manages
to ICE (this is with checking enabled, of course):
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc
x.cc: In member function `void X::bar()':
x.cc:6: internal compiler error: tree check: expected identifier_node, have
baselink in cxx_scope_find_binding_for_name, at cp/decl.c:2384
Please submit a full bug report,
with preprocessed source if appropriate.
So there are two bugs: that 3.3.x ICEs, and that the other compilers
actually accept the code. I'd bet that it is invalid; btw, icc8 says
g/x> icc -Xc -ansi -c x.cc
x.cc(4): warning #470: qualified name is not allowed in member declaration
void X::bar()
^
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|[3.3 Regression] C++ parse |[3.3 Regression] Trouble
|error in 3.3, OK in 3.2 and |with qualified declaration
|3.4 |in class
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16777
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/16777] [3.3 Regression] Trouble with qualified declaration in class
2004-07-27 3:16 [Bug c++/16777] New: C++ parse error in 3.3, OK in 3.2 and 3.4 lindahl at pathscale dot com
2004-07-27 3:27 ` [Bug c++/16777] [3.3 Regression] " pinskia at gcc dot gnu dot org
2004-07-27 3:38 ` [Bug c++/16777] [3.3 Regression] Trouble with qualified declaration in class bangerth at dealii dot org
@ 2004-07-27 3:43 ` lindahl at pathscale dot com
2004-07-27 3:56 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: lindahl at pathscale dot com @ 2004-07-27 3:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lindahl at pathscale dot com 2004-07-27 03:43 -------
I _think_ that Sun's C++ guru approved this code, but if you like I can send a
question back through channels -- I'm not a C++ language laywer. Sun's compiler
does accept it, apparently. This is a snippet from an ISV code.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16777
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/16777] [3.3 Regression] Trouble with qualified declaration in class
2004-07-27 3:16 [Bug c++/16777] New: C++ parse error in 3.3, OK in 3.2 and 3.4 lindahl at pathscale dot com
` (2 preceding siblings ...)
2004-07-27 3:43 ` lindahl at pathscale dot com
@ 2004-07-27 3:56 ` pinskia at gcc dot gnu dot org
2004-07-27 4:05 ` bangerth at dealii dot org
2004-07-27 13:17 ` bangerth at dealii dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-27 3:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-27 03:56 -------
Note after removing the "qualified declaration", gcc 3.3.3 rejects the code so that is still a bug.
Now the other issue in this bug is a different bug all together.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16777
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/16777] [3.3 Regression] Trouble with qualified declaration in class
2004-07-27 3:16 [Bug c++/16777] New: C++ parse error in 3.3, OK in 3.2 and 3.4 lindahl at pathscale dot com
` (3 preceding siblings ...)
2004-07-27 3:56 ` pinskia at gcc dot gnu dot org
@ 2004-07-27 4:05 ` bangerth at dealii dot org
2004-07-27 13:17 ` bangerth at dealii dot org
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-07-27 4:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-07-27 04:05 -------
gcc3.3 required you to write
this->X::template foo<int> ();
That's fixed, though, in 3.4 and beyond and immaterial to the bug here.
Note, however, that using above syntax also gets us rid of the ICE.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16777
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/16777] [3.3 Regression] Trouble with qualified declaration in class
2004-07-27 3:16 [Bug c++/16777] New: C++ parse error in 3.3, OK in 3.2 and 3.4 lindahl at pathscale dot com
` (4 preceding siblings ...)
2004-07-27 4:05 ` bangerth at dealii dot org
@ 2004-07-27 13:17 ` bangerth at dealii dot org
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-07-27 13:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-07-27 13:17 -------
I have separated this PR into two new ones about the different
parts of what's going wrong here: PR 16781 and PR 16782. This
PR is therefore obsolete.
W.
*** This bug has been marked as a duplicate of 16781 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16777
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-07-27 13:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-27 3:16 [Bug c++/16777] New: C++ parse error in 3.3, OK in 3.2 and 3.4 lindahl at pathscale dot com
2004-07-27 3:27 ` [Bug c++/16777] [3.3 Regression] " pinskia at gcc dot gnu dot org
2004-07-27 3:38 ` [Bug c++/16777] [3.3 Regression] Trouble with qualified declaration in class bangerth at dealii dot org
2004-07-27 3:43 ` lindahl at pathscale dot com
2004-07-27 3:56 ` pinskia at gcc dot gnu dot org
2004-07-27 4:05 ` bangerth at dealii dot org
2004-07-27 13:17 ` bangerth at dealii 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).