public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43824] New: C++0x feature "inline namespace" enabled under -std=c++98; no warnings
@ 2010-04-20 21:46 bergner at gcc dot gnu dot org
2010-04-21 0:24 ` [Bug c++/43824] " paolo dot carlini at oracle dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: bergner at gcc dot gnu dot org @ 2010-04-20 21:46 UTC (permalink / raw)
To: gcc-bugs
Inline namespace definitions are a feature proposed under C++0x. The feature
is not part of the C++98/03 standards. Code that uses it under -std=c++98
-Wall -Wextra -pedantic should get at least a warning.
bergner@etna:~/gcc/BUGS/> cat t.cpp
inline namespace A { }
bergner@etna:~/gcc/BUGS/> g++ -std=c++98 -Wall -Wextra -pedantic -c t.cpp
bergner@etna:~/gcc/BUGS/> echo $?
0
This seems to also be the case for GCC 4.4 and 4.5.
--
Summary: C++0x feature "inline namespace" enabled under -
std=c++98; no warnings
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bergner at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43824
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/43824] C++0x feature "inline namespace" enabled under -std=c++98; no warnings
2010-04-20 21:46 [Bug c++/43824] New: C++0x feature "inline namespace" enabled under -std=c++98; no warnings bergner at gcc dot gnu dot org
@ 2010-04-21 0:24 ` paolo dot carlini at oracle dot com
2010-04-21 9:41 ` redi at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-04-21 0:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2010-04-21 00:24 -------
This new feature of C++0x has been pioneered by GCC, used for the
implementation of the special modes of the C++ library (eg, debug-mode, then
parallel-mode, etc). I'm not sure how much we can tighten the warnings without
breaking the long standing usages as implementation detail. If/when we change
something we should also make sure variadic templates are treated consistently.
Adding Jason in CC.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43824
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/43824] C++0x feature "inline namespace" enabled under -std=c++98; no warnings
2010-04-20 21:46 [Bug c++/43824] New: C++0x feature "inline namespace" enabled under -std=c++98; no warnings bergner at gcc dot gnu dot org
2010-04-21 0:24 ` [Bug c++/43824] " paolo dot carlini at oracle dot com
@ 2010-04-21 9:41 ` redi at gcc dot gnu dot org
2010-04-21 16:54 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-04-21 9:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from redi at gcc dot gnu dot org 2010-04-21 09:40 -------
Right, this is a GNU extension used to implement the library, which was later
standardised. We also support 'long long' in C++03 mode.
GCC is not intended to be a strict ANSI C++ verification tool, so doesn't
reject all non-portable programs
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43824
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/43824] C++0x feature "inline namespace" enabled under -std=c++98; no warnings
2010-04-20 21:46 [Bug c++/43824] New: C++0x feature "inline namespace" enabled under -std=c++98; no warnings bergner at gcc dot gnu dot org
2010-04-21 0:24 ` [Bug c++/43824] " paolo dot carlini at oracle dot com
2010-04-21 9:41 ` redi at gcc dot gnu dot org
@ 2010-04-21 16:54 ` pinskia at gcc dot gnu dot org
2010-04-21 17:05 ` redi at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-04-21 16:54 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 994 bytes --]
------- Comment #3 from pinskia at gcc dot gnu dot org 2010-04-21 16:54 -------
(In reply to comment #2)
> Right, this is a GNU extension used to implement the library, which was later
> standardised. We also support 'long long' in C++03 mode.
Yes but with -pedantic we do warn about long long:
t.cc:1:1: warning: ISO C++ 1998 does not support âlong longâ
(and with -pedantic-error we error out). So the argument using long long as an
example is incorrect.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |accepts-invalid
Last reconfirmed|0000-00-00 00:00:00 |2010-04-21 16:54:00
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43824
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/43824] C++0x feature "inline namespace" enabled under -std=c++98; no warnings
2010-04-20 21:46 [Bug c++/43824] New: C++0x feature "inline namespace" enabled under -std=c++98; no warnings bergner at gcc dot gnu dot org
` (2 preceding siblings ...)
2010-04-21 16:54 ` pinskia at gcc dot gnu dot org
@ 2010-04-21 17:05 ` redi at gcc dot gnu dot org
2010-07-26 10:00 ` rodrigorivascosta at gmail dot com
2010-09-10 18:29 ` jason at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-04-21 17:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from redi at gcc dot gnu dot org 2010-04-21 17:04 -------
good point
then #pragma GCC system_header must disable the warning, so we can use inline
namespaces and variadic templates in the standard library
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43824
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/43824] C++0x feature "inline namespace" enabled under -std=c++98; no warnings
2010-04-20 21:46 [Bug c++/43824] New: C++0x feature "inline namespace" enabled under -std=c++98; no warnings bergner at gcc dot gnu dot org
` (3 preceding siblings ...)
2010-04-21 17:05 ` redi at gcc dot gnu dot org
@ 2010-07-26 10:00 ` rodrigorivascosta at gmail dot com
2010-09-10 18:29 ` jason at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: rodrigorivascosta at gmail dot com @ 2010-07-26 10:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from rodrigorivascosta at gmail dot com 2010-07-26 09:59 -------
Created an attachment (id=21313)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21313&action=view)
Patch to add pedantic warning to inline namespaces in C++98
I think that this tiny patch should do the trick.
Regards.
-- Rodrigo.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43824
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/43824] C++0x feature "inline namespace" enabled under -std=c++98; no warnings
2010-04-20 21:46 [Bug c++/43824] New: C++0x feature "inline namespace" enabled under -std=c++98; no warnings bergner at gcc dot gnu dot org
` (4 preceding siblings ...)
2010-07-26 10:00 ` rodrigorivascosta at gmail dot com
@ 2010-09-10 18:29 ` jason at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-09-10 18:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jason at gcc dot gnu dot org 2010-09-10 18:29 -------
Subject: Bug 43824
Author: jason
Date: Fri Sep 10 18:28:59 2010
New Revision: 164201
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164201
Log:
PR c++/43824
* error.c (maybe_warn_cpp0x): Add new warning
CPP0X_INLINE_NAMESPACES.
* parser.c (cp_parser_namespace_definition): Likewise.
* cp-tree.h (cpp0x_warn_str): Likewise.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/inline-ns4.C
trunk/gcc/testsuite/g++.dg/cpp0x/inline-ns5.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/error.c
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C
trunk/gcc/testsuite/g++.dg/lookup/strong-using-1.C
trunk/gcc/testsuite/g++.dg/lookup/strong-using-2.C
trunk/gcc/testsuite/g++.dg/lookup/strong-using-3.C
trunk/gcc/testsuite/g++.dg/lookup/strong-using-5.C
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43824
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-09-10 18:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-20 21:46 [Bug c++/43824] New: C++0x feature "inline namespace" enabled under -std=c++98; no warnings bergner at gcc dot gnu dot org
2010-04-21 0:24 ` [Bug c++/43824] " paolo dot carlini at oracle dot com
2010-04-21 9:41 ` redi at gcc dot gnu dot org
2010-04-21 16:54 ` pinskia at gcc dot gnu dot org
2010-04-21 17:05 ` redi at gcc dot gnu dot org
2010-07-26 10:00 ` rodrigorivascosta at gmail dot com
2010-09-10 18:29 ` jason 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).