[Bug c++/66641] New: An instance of an attribute-specifier-seq implies a simple-declaration while C++11 permits attribute-declaration and using-directive

andrey.vul at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jun 23 15:00:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66641

            Bug ID: 66641
           Summary: An instance of an attribute-specifier-seq implies a
                    simple-declaration while C++11 permits
                    attribute-declaration and using-directive
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrey.vul at gmail dot com
  Target Milestone: ---

The presence of an attribute-specifier-seq implies that the statement is one
of:
(1) simple-declaration:
        attribute-specifier-seq decl-specifier-seq_opt init-declarator-list ;
(2) attribute-declaration:
        attribute-specifier-seq ;
(3) using-directive:
        attribute-specifier-seq_opt using namespace nested-name-specifier_opt
namespace-name ;

Gcc only accepts the first case.

SOURCE (attr.cc):
[[]] int x;
[[]];
namespace A {};
[[]] using namespace A;

INVOCATION:
g++ -std=c++11 attr.cc -c -o /dev/null

OUTPUT (4.8.2, 5.1.0):
attr.cc:2:4: error: declaration does not declare anything [-fpermissive]
 [[]];
    ^
attr.cc:4:6: error: expected unqualified-id before ‘using’
 [[]] using namespace A;
      ^


More information about the Gcc-bugs mailing list