This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/64267] New: [DR 482] Qualified declarators in redeclarations


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

            Bug ID: 64267
           Summary: [DR 482] Qualified declarators in redeclarations
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

namespace S
{
  struct coll;
  struct ::S::coll { };
}

qual.cc:4:20: error: global qualification of class name is invalid before â{â
token
   struct ::S::coll { };
                    ^

Clang 3.4 rejected this but 3.5 accepts it (with a -Wextra-qualification
warning) and EDG accepts it.

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#482 makes this
valid, in at least C++14 (but it's a DR against C++11 so maybe there too).

The example from DR 482 is:

    void f();
    void ::f();        // error: qualified declarator

    namespace N {
      void f();
      void N::f() { }  // error: qualified declarator
    }

I get the same results for this, Clang 3.4 rejects, 3.5+ accepts, EDG accepts,
and G++ rejects in all modes:

dr482.cc:2:14: error: explicit qualification in declaration of âvoid f()â
     void ::f();        // error: qualified declarator
              ^
dr482.cc:6:17: error: explicit qualification in declaration of âvoid N::f()â
       void N::f() { }  // error: qualified declarator
                 ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]